VBA help. Please

New Contributor

Hi, 

 

I am working on an excel file with various sheets and I am wondering how could I automatically move multiple rows with VBA to specific columns and after that to consolidate everything into one sheet. There are like 6000 sheets or more. 

I have attached a screenshot of the workbook to show the structure. Some sheets have more then 70 arrows. 

How can I, for example move the arrows 4 -10 to columns D-M? 

I would really appreciate if someone could help me if possible. 

Thank you AAA.PNG

 

3 Replies

@Oana201190 

Here is a simple VBA code to copy.

 

Sub commanbutton1_click()
    Sheets("Sheet2").Range("A2:Z500").Copy  Sheets("Sheet1").Range("A2")
End Sub

 

 

Hope I was able to help you with this information.

 

NikolinoDE

I know I don't know anything (Socrates)

 

Thank you for your reply. I really appreciate it. I tried running it but I was unsuccessful. I'm prompted with this error. runtime error 9, subscript out of range

@Oana201190 

This means that you have different table names than what is shown in the code.

You need to change the names in "Sheet1 or 2" in your workbook's existing sheet names. Sheets("Sheet2").Range("A2:Z500").Copy Sheets("Sheet1").Range("A2")

 

Hope I was able to help you with this info.

 

NikolinoDE

I know I don't know anything (Socrates)