Hi,
I've got a code that compiles several sheets into one combined sheet. However, I want to add to my code some adjustments to be made for the newly created combined sheet. The code to compile the data is this:
Sub Test()
Dim SH As Worksheet
Dim J As Integer
Application.ScreenUpdating = False
For Each SH In ThisWorkbook.Sheets
SH.Rows("1:3").EntireRow.Delete
SH.Columns("A:B").EntireColumn.Delete
SH.Columns("E:E").EntireColumn.Delete
SH.Cells.UnMerge
Next
On Error Resume Next
Sheets(1).Select
Worksheets.Add ' add a sheet in first place
Sheets(1).Name = "Combined"
' copy headings
Sheets(2).Activate
Range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).Range("A1")
' work through sheets
For J = 2 To Sheets.Count ' from sheet 2 to last sheet
Sheets(J).Activate ' make the sheet active
Range("A1").Select
Selection.CurrentRegion.Select ' select all cells in this sheets
' select all lines except title
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
' copy cells selected in the new sheet on last line
Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2)
Next
End Sub
And the code I've recorded that I want done to the newly created combined sheet is this:
Sub Macro2()
'
' Macro2 Macro
'
'
Columns("A:D").Select
Columns("A:D").EntireColumn.AutoFit
Columns("B:B").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.EntireRow.Delete
Columns("A:A").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
End Sub
Is there a way I can combine these macros into one so that it does both at the same time in the proper sequence? Thanks!
Bookmarks