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

مساعدة فى تصحيح كود vba


koky_dar

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

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

لدي هذا الكود الخاص بالبحث داخل عدة شيتات

الكود يعمل بشكل سليم عند  البحث عن أسم او نص

   !!ولكن عند البحث عن رقم لا يبحث 

فيرجي من الخبراء مراجعة الكود واخباري بالسبب

ولكم جزيل الشكر

Sub seach()
Dim sh As Worksheet, rng As Range, x As Byte, a As Byte, d As Long, e As Long, y As Long
Application.ScreenUpdating = False
Set sh = Sheets("Search")
sh.Range("A5:J1000").Clear
Set rng = sh.Range("A2")
x = Sheets.Count
For a = 1 To x
If Sheets(a).Name <> "Search" Then
Sheets(a).Select
d = Cells(1000, 1).End(xlUp).Row + 1
For y = 2 To d
e = sh.Cells(1000, 1).End(xlUp).Row + 1
If rng = Left(Cells(y, 1), Len(rng)) Then
sh.Cells(e, 1) = Sheets(a).Name
sh.Cells(e, 2) = Cells(y, 3).Address
sh.Cells(e, 3) = Cells(y, 1)
sh.Cells(e, 4) = Cells(y, 2)
sh.Cells(e, 5) = Cells(y, 3)
sh.Cells(e, 6) = Cells(y, 4)
sh.Cells(e, 7) = Cells(y, 5)
sh.Cells(e, 8) = Cells(y, 6)
sh.Cells(e, 9) = Cells(y, 7)
sh.Cells(e, 10) = Cells(y, 8)

End If
Next
End If
Next
Sheets("Search").Select
Application.ScreenUpdating = True
End Sub

 

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

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