I suppose at this point, I should turn yellow, open a can of Duff Beer &
utter those famous words... "Doh!!"
But then, I suppose,if you use VBA regularly, you'd know this... I don't
which is why I'm really grateful for th ehelp on this & other NG's
"Dave Peterson" wrote in message
If you're running the code against the activesheet, you could just change:
Colin Foster wrote:
Thanks for this.
The code (as it stands at the moment) is...
Public Sub SelectiveDelete()
Dim LRowData As Long, ir As Long
' detect last row of data in column A
LRowData = .Cells(Rows.Count, "A").End(xlUp).Row
' scan list testing if the value is in range
For ir = LRowData To 1 Step -1
If Trim(.Cells(ir, 1).Value) = "A/C NO" Or _
Trim(.Cells(ir, 1).Value) = "Report Total" Or _
Trim(.Cells(ir, 1).Value) = "Evolut" Or _
Trim(.Cells(ir, 1).Value) = "Evoluti" Or _
Trim(.Cells(ir, 1).Value) = "-------" Or _
InStr(1, Trim(.Cells(ir, 2).Value), "@") 0 Or _
Len(Trim(.Cells(ir, 2).Value)) = 0 _
Then .Rows(ir).Delete Shift:=xlUp
So where would I put your code? Or, due to the coding that I'm using, do
need it worded differently?
Thanks, again, for your interest.
"Chip Pearson" wrote in message
Instead of writing code like
you can have to macro refer to whatever sheet is active in Excel.
If you want this to work on all worksheets at one time, use
Dim WS As Worksheet
For Each WS In Worksheets
Microsoft MVP - Excel
Pearson Software Consulting, LLC
"Colin Foster" wrote in message
I've got a macro working (thanks to help from this NG) to delete
specified rows of data from a spreadsheet. Unfortunately, I have to go
into the VBA code to change th esheet name from "Sheet1" to the actual
name of the sheet. As I want to be able to use this code on more than
sheet (& possibly across workbooks) is there a simple line of code
can put into the VBA to automatically put in th ecorrect sheet name &