اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

ترحيل بيانات بشرط معين


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

ترحيل بيانات بشرط معين


السلام عليكم 

برجاء المساعده في ترحيل البيانات من شيت في العمود E بايانات بعد النقل يمسح البايانات 

عند الترحيل مره اخر يرحل تحت السابق 

وشكرا 


 

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

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

تفضل اخي 

Sub test1()
Dim Dernlige As Long
Dim wsData  As Worksheet
Dim wsDest  As Worksheet
Dim lr      As Long
Dim i As Integer

Application.ScreenUpdating = False
Set wsData = Worksheets("Date Sales")
Set wsDest = Worksheets("sales")

lr = wsData.Cells(Rows.Count, "A").End(xlUp).Row + 1
   For i = 3 To lr
     If Cells(i, 5) <> "" Then
     
       Dernlige = wsDest.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
       
       Range(Cells(i, 1), Cells(i, 6)).Copy Destination:=wsDest.Cells(Dernlige, 1)
       
          End If
    Next i
    wsData.Range("A3:F" & lr).ClearContents
    
End Sub

 

 

Book1_v3.xlsm

تم تعديل بواسطه Mohamed Hicham
  • Like 1
  • Thanks 1
رابط هذا التعليق
شارك

وعليكم السلام

ممكن خيار آخر

Sub test()
Dim a, temp
a = Cells(1, 1).CurrentRegion
 temp = Application.Transpose(Filter(Evaluate("transpose(if((" & Columns(5).Address & "<>""" & """)*(" & Columns(5).Address & "<>""" _
                    & "Invoice No" & """),row(1:" & Rows.Count & ")))"), False, 0))
Cells(1, 1).CurrentRegion.Offset(2).ClearContents
 a = Application.Index(a, temp, [{1, 2, 3, 4, 5, 6}])
 With Sheets("sales")
 .Cells(.Cells(Rows.Count, 1).End(xlUp).Row + 1, 1).Resize(UBound(a), UBound(a, 2)) = a
 End With
End Sub

 

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

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