Function findlastrow(whatsheet)
findlastrow = ThisWorkbook.Worksheets(whatsheet).Cells(Rows.Count, 1).End(xlUp).Row
End Function
Sub Combinesheets()
'this code assumes your master sheet is on the first sheet
'It will loop through each sheet and place the contents onto the first sheet
Dim tabcount
Dim rowcounter
Dim thevalue
Dim sheetsList()
sheetsList() = [{"Sheet2","Sheet4"}] ' place your sheet names here
thetab = UBound(sheetsList) - LBound(sheetsList) + 1
For tabcounter = 1 To thetab
For rowcounter = 1 To findlastrow(sheetsList(tabcounter))
thevalue = ThisWorkbook.Worksheets(sheetsList(tabcounter)).Cells(rowcounter, 1).Value
ThisWorkbook.Worksheets(1).Range("A" & findlastrow(1) + 1).Value = thevalue
Next
Next
End Sub
Function findlastrow(whatsheet)
findlastrow = ThisWorkbook.Worksheets(whatsheet).Cells(Rows.Count, 1).End(xlUp).Row
End Function
Sub CombineSheets()
'It will loop through each sheet and place the contents onto the sheet set by placesheet
Dim tabcount
Dim rowcounter
Dim thevalue
Dim Z
Dim sheetsList()
Dim placesheet
placesheet = "Sheet4" 'this is the sheet you wish to move them to
Z = 26 ' this is the number of columns to copy to the new sheet!
sheetsList() = [{"Sheet6","Sheet7"}] ' place your sheet names here
thetab = UBound(sheetsList) - LBound(sheetsList) + 1
For tabcounter = 1 To thetab
For rowcounter = 1 To findlastrow(sheetsList(tabcounter))
For columnCount = 1 To Z
thevalue = ThisWorkbook.Worksheets(sheetsList(tabcounter)).Cells(rowcounter, columnCount).Value
ThisWorkbook.Worksheets(placesheet).Cells(findlastrow(placesheet) + 1, columnCount).Value = thevalue
Next
Next
Next
End Sub
Function findlastrow(whatsheet)
findlastrow = ThisWorkbook.Worksheets(whatsheet).Cells(Rows.Count, 1).End(xlUp).Row
End Function
Sub CombineSheets()
'Start here. This code will loop through
'each sheet in the sheetsList() array,
'and places the contents onto the sheet identified in placesheet
'!The list names in sheetList() must Match the Sheet names!
Dim tabcount, rowcounter, Z
Dim thevalue
Dim sheetsList()
Dim placesheet, placesheetrow
placesheet = "Sheet1" 'this is the sheet you wish to move them to
Z = 15 ' this is the number of columns to copy to the new sheet!
sheetsList() = [{"Sheet3","Sheet4","Sheet2"}] 'this is the sheet list
thetab = UBound(sheetsList) - LBound(sheetsList) + 1
For tabcounter = 1 To thetab
For rowcounter = 1 To findlastrow(sheetsList(tabcounter))
placesheetrow = findlastrow(placesheet) + 1
For columnCount = 1 To Z
thevalue = ThisWorkbook.Worksheets(sheetsList(tabcounter)).Cells(rowcounter, columnCount).Value
ThisWorkbook.Worksheets(placesheet).Cells(placesheetrow, columnCount).Value = thevalue
Next
Next
Next
End Sub
Do you know how to build a " for loop " in VBA?