0

First of all I am learning VBA new, thats why the code is very simple I think.

I made a macro with this logic:

  • Step 1 :go on Sheet "table1" and copy cell "C1" & "E2"
  • Step 2: Then go "table2" and Past cells in "A1" & "B1"
  • Step 3: Delet in "table1" the Columns 1-10

What I strugle now are these steps:

  • Step 4: Past the next copy cell from "table1" under the other values in "table2"
  • Step 5: Run the whole "table1" till there is no value automaticaly.

Sub Mve()

Sheets("table1").Select
Range("C1").Select
Selection.copy
Sheets("table2").Select
Range("A1").Select
ActiveSheet.Paste
Sheets("table1").Select
Range("E2").Select
Selection.copy
Sheets("table2").Select
Range("B1").Select
ActiveSheet.Paste

Sheets("table1").Select
Rows("1:10").Select
Selection.Cut
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp

End Sub

Can anybody help me? Thank you:)

Kerem
  • 9
  • 3
  • I would like to confirm if you are going to delete columns 1 to 10 in table 1? Since the code you have written is deleting rows instead. – 3LexW Apr 21 '21 at 13:25
  • Also, you can learn the `Do-while-loop` structure in VBA, where you can set the exit condition so the program will terminate if cell C1 and/or cell M2 is empty. – 3LexW Apr 21 '21 at 13:27

0 Answers0