اذهب الي المحتوي
أوفيسنا

حل مشكلة حذف صف يحتوي على خلية مؤمنة


إذهب إلى أفضل إجابة Solved by أبوأحـمـد,

الردود الموصى بها

السلام عليكم و رحمة الله و بركاته 

ارجو المساعدة في الكود التالي الذي يقوم بحذف صف يحتوي على خلية مؤمنة بكلمة سر  او كود اخر يقوم بحذف الصف المؤمن و جزاكم الله خير

Dim x As Long
Dim y As Long
x = Sheets("الجرد ").Range("B" & Rows.Count).End(xlUp).Row
For y = 2 To x
If Sheets("الجرد ").Cells(y, 2).Text = TextBox1.Value Then
Rows(y).Delete shift:=xlUp
End If
Next y
MsgBox ("تم حذف المادة" & " " & TextBox5.Value), vbCritical

 

dell.jpg

رابط هذا التعليق
شارك

وعليكم السلام ورحمه الله وبركاته

جرب هذا الكود علي حسب ما فهمت لعله المطلوب

 


Dim x As Long
Dim y As Long
x = Sheets("الجرد ").Range("B" & Rows.Count).End(xlUp).Row
For y = x To 2 Step -1
    If Sheets("الجرد ").Cells(y, 2).Value = TextBox1.Value Then ' قمت بتغيير .Text إلى .Value
        Rows(y).Delete shift:=xlUp
    End If
Next y
MsgBox ("تم حذف المادة" & " " & TextBox5.Value), vbCritical

 

رابط هذا التعليق
شارك

  • أفضل إجابة

وعليكم السلام ورحمة الله وبركاته

الحل قبل الحذف فك حماية الورقة وحمايتها مرة أخرى بعد الحذف

فك الحماية
ActiveSheet.unprotect Password:="123"

إعادة الحماية
ActiveSheet.protect Password:="123"

مع مراعاة رقم الحماية الخاص بك بدل 123

 

  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information