Reputation: 65
I have a workbook which consist of a main sheet "Monthly collection reeport" and few sheets with dates. I need to pull the data from all sheets (only total column C14-D14) to main sheet "Monthly" (C4-D14 ) one below other first column with sheet names in column B1-B13 respectively.
Upvotes: 0
Views: 274
Reputation: 65
So the final codes will be
Sub xxxxx()
Dim j As Integer
x = Sheets.Count ' count no of sheets
For j = 4 To x + 2
Range("B" & j) = Worksheets(j - 2).Name ' main sheet must be the first, run code from main sheet
Next
End Sub
Upvotes: 0
Reputation: 138
Adjust this to your needs:
Sub xxxxx()
Dim j As Integer
x = Sheets.Count ' count no of sheets
For j = 1 To x - 1
Range("a" & j) = Worksheets(j + 1).Name ' main sheet must be the first, run code from main sheet
Next
End Sub
Upvotes: 1