YOYO
08-29-2017, 01:29 PM
I need combine selected formatted data from different worksheet into one worksheet.
tab 1 called " statement" where all the combined data need go to
tab 2 "summary" is where the "statement" header where. This tab will not be including when I combine the data
tab 3 called " cash" which is formatted already ( using vba)
tab 4 called " check" which is formatted already (using vba)
tab 5.... tab 6.... tab 6...
I need: 1. show the formatted header from "summary"
2. add on tab 3 and tab 4, tab5, tab 6.... data after the header
3. all those tab won't be delete after it combined into "statement"
I have this code here which works before but not working properly now .
please help!!!!
code:
Sub CombineData()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Data" And Sht.Range("A2").Value <> "" Then
Sht.Select
lastrow = Range("A65536").End(xlUp).Row
Range("A1", Cells(lastrow + 1, "E")).Copy
Sheets("Statement").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sht.Select
Range("A2", Cells(lastrow, "M")).ClearContents
Else
End If
Next Sht
End Sub
tab 1 called " statement" where all the combined data need go to
tab 2 "summary" is where the "statement" header where. This tab will not be including when I combine the data
tab 3 called " cash" which is formatted already ( using vba)
tab 4 called " check" which is formatted already (using vba)
tab 5.... tab 6.... tab 6...
I need: 1. show the formatted header from "summary"
2. add on tab 3 and tab 4, tab5, tab 6.... data after the header
3. all those tab won't be delete after it combined into "statement"
I have this code here which works before but not working properly now .
please help!!!!
code:
Sub CombineData()
Dim Sht As Worksheet
For Each Sht In ActiveWorkbook.Worksheets
If Sht.Name <> "Data" And Sht.Range("A2").Value <> "" Then
Sht.Select
lastrow = Range("A65536").End(xlUp).Row
Range("A1", Cells(lastrow + 1, "E")).Copy
Sheets("Statement").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Sht.Select
Range("A2", Cells(lastrow, "M")).ClearContents
Else
End If
Next Sht
End Sub