Henry Chiavaroli
New Member
This macro selects rows containing "qm" in a column on sheet check book balance and copies them to a new sheet labeled QM. In order to run it again I have to delete the sheet it created - QM.
I would like it to copy over existing sheets (QM,etc) and also be able to select other items in that same column and copy them to their respective sheets at the same time - mbr or t4t.
Is that possible or will I need seperate macros?
Sub ee_CheckBookSummary()
Dim ws As Worksheet, rng As Range, Remark As String, ws2 As Worksheet
Set ws = Sheets("Check book balance")
Remark = UCase("qm")
Set rng = ws.Range(Cells(3, 1), Cells(Rows.Count, Columns.Count).End(xlToLeft))
Sheets.Add(Sheets(Sheets.Count)).Name = Remark
Set ws2 = Sheets(Remark)
ws.Range("A3").AutoFilter 'NO BLANK ROWS; needs contiguous row data!
rng.AutoFilter Field:=9, Criteria1:=Remark
With ws
.UsedRange.SpecialCells(xlCellTypeVisible).Copy ws2.Range("A1")
.ShowAllData
End With
ws2.Cells.EntireColumn.AutoFit
End Sub
I would like it to copy over existing sheets (QM,etc) and also be able to select other items in that same column and copy them to their respective sheets at the same time - mbr or t4t.
Is that possible or will I need seperate macros?
Sub ee_CheckBookSummary()
Dim ws As Worksheet, rng As Range, Remark As String, ws2 As Worksheet
Set ws = Sheets("Check book balance")
Remark = UCase("qm")
Set rng = ws.Range(Cells(3, 1), Cells(Rows.Count, Columns.Count).End(xlToLeft))
Sheets.Add(Sheets(Sheets.Count)).Name = Remark
Set ws2 = Sheets(Remark)
ws.Range("A3").AutoFilter 'NO BLANK ROWS; needs contiguous row data!
rng.AutoFilter Field:=9, Criteria1:=Remark
With ws
.UsedRange.SpecialCells(xlCellTypeVisible).Copy ws2.Range("A1")
.ShowAllData
End With
ws2.Cells.EntireColumn.AutoFit
End Sub