Macro copy data from multi sheets to other sheet

ste33uka

Active Member
Joined
Jan 31, 2020
Messages
471
Office Version
  1. 365
Platform
  1. Windows
Hi would any on have a macro code that would copy data from sheets 6,7,8,9,10 cells A70 to F130 to the next available row on a sheet called 'DATA'
My sheet names are just 6,7,8,9,10
Thanks
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How about
VBA Code:
Sub ste33uka()
   Dim i As Long
   
   For i = 6 To 10
      Sheets(CStr(i)).Range("A70:F130").Copy Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
   Next i
End Sub
 
Upvote 0
How about
VBA Code:
Sub ste33uka()
   Dim i As Long
  
   For i = 6 To 10
      Sheets(CStr(i)).Range("A70:F130").Copy Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
   Next i
End Sub

Thanks again fluff, thats perfect
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0
Glad to help & thanks for the feedback.

Is it possible marco would only copy data from sheets based on a cell value ?
example
sheet1.cell Z1 = yes ,data could copy to sheet called data
sheett2.cell Z2 = no , data would copy to sheet called nodata
Thanks
 
Upvote 0
How about
VBA Code:
Sub ste33uka()
   Dim i As Long
   
   For i = 6 To 10
      With Sheets(CStr(i))
         If LCase(.Range("Z1").Value) = "yes" Then
            .Range("A70:F130").Copy Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
         Else
            .Range("A70:F130").Copy Sheets("NoData").Range("A" & Rows.Count).End(xlUp).Offset(1)
         End If
      End With
   Next i
End Sub
 
Upvote 0
How about
VBA Code:
Sub ste33uka()
   Dim i As Long
  
   For i = 6 To 10
      With Sheets(CStr(i))
         If LCase(.Range("Z1").Value) = "yes" Then
            .Range("A70:F130").Copy Sheets("Data").Range("A" & Rows.Count).End(xlUp).Offset(1)
         Else
            .Range("A70:F130").Copy Sheets("NoData").Range("A" & Rows.Count).End(xlUp).Offset(1)
         End If
      End With
   Next i
End Sub

Thanks but i might need to add other sheet options
would you have code for say
sheet1.cell Z1 = yes ,data could copy to sheet called data
sheett2.cell Z1 = no , data would copy to sheet called nodata
sheet3.cell Z1 - maybe, data would copy to sheet called maybe
 
Upvote 0
Ok, if you get stuck, just post what you've tried.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,812
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top