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

تعديل كود اعطى #REF


إذهب إلى أفضل إجابة Solved by lionheart,

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

الكود التالي لنقل الاعمدة الموضح بالرقام من صفحة الى اخرى 
 

Sub Cycles()
 Dim a
 With Sheets("DataT1").Cells(1).CurrentRegion
 a = .Value
 With Sheets("CyclesT1")
 .Cells(1, 1).Resize(UBound(a), 31) = Application.Index(a, Evaluate("row(1:" & UBound(a) & ")"), [{1,2,4,6,7,8,9,10,11,12,13,14,15,16,17}])
 End With: End With
 End Sub



قمت بالتعديل على ارقام الاعمدة التي يراد نقلها كما هو موضح بالكود التالي

Sub CyclesB1T1()
 Dim a
 With Sheets("B1DataT1").Cells(1).CurrentRegion
 a = .Value
 With Sheets("CyB1T1")
 .Cells(1, 1).Resize(UBound(a), 15) = Application.Index(a, Evaluate("row(1:" & UBound(a) & ")"), [{20,21,23,25,26,27,28,29,30,31,32,33,34,35,36}])
 End With: End With
 End Sub

مما ادى الى ظهور  #REF عند التنفيذ

ما الخطأ 

 

T1.xlsb

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

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

مع الشكر الجزيل لاهتمامكم

اذا امكن التطبيق على المرفق

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

  • أفضل إجابة

Learn the basics my bro

Just instead of using CurrentRegion feature change the range you are dealing with

example

Sub Test()
    Dim lr As Long
    With ActiveSheet
        lr = .Cells(Rows.Count, 1).End(xlUp).Row
        a = .Range("A2:Z" & lr).Value
        
    End With
End Sub

 

  • 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