I want to loop through 10 worksheets in my workbook (sheet1, sheet2...sheet10) and copy the data from A1 in each sheet and paste into column A in sheets("data"). Sheets("data") is part of the same workbook.
Many thanks in advance
I want to loop through 10 worksheets in my workbook (sheet1, sheet2...sheet10) and copy the data from A1 in each sheet and paste into column A in sheets("data"). Sheets("data") is part of the same workbook.
Many thanks in advance
Hi pablowilks,
Try this:
Regards,![]()
Option Explicit Sub Macro1() 'Written by Trebor76 'Visit my website www.excelguru.net.au Dim wstMySheet As Worksheet Dim lngMyRow As Long Application.ScreenUpdating = False For Each wstMySheet In ThisWorkbook.Sheets If wstMySheet.Name <> "data" Then If lngMyRow = 0 Then lngMyRow = 1 'Initial output row number on the 'data' tab. Change to suit. Else lngMyRow = Sheets("data").Cells(Rows.Count, "A").End(xlUp).Row + 1 End If Sheets("data").Range("A" & lngMyRow).Value = wstMySheet.Range("A1").Value End If Next wstMySheet Application.ScreenUpdating = True MsgBox "Process is complete" End Sub
Robert
____________________________________________
Please ensure you mark your thread as Solved once it is. Click here to see how
If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post
this is great thankyou Robert
Thanks for the feedback and you're welcome![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks