Hi,
would it be possible to delete all rows in my worksheets where any field in column F has $, i dont want to delete rows where column F contain $ but only rows where the cell only has $.
hopefully that makes sense?
Printable View
Hi,
would it be possible to delete all rows in my worksheets where any field in column F has $, i dont want to delete rows where column F contain $ but only rows where the cell only has $.
hopefully that makes sense?
The following coding has helped alot but i'm not sure how to have it running across all worksheets?
Code:Sub test()
With ActiveSheet
.AutoFilterMode = False
With Range("f1", Range("f" & Rows.Count).End(xlUp))
.AutoFilter 1, "*$*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
End With
End Sub
something like:
Code:Sub delRows()
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Set wb = ActiveWorkbook 'or set to a specific workbook name
For i = 1 To wb.Sheets.Count
Set ws = wb.Sheets(i)
With ws
'do stuff
End With
Next i
End Sub
hi
i have tried the following but it doesnt do anything?
Code:Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Set wb = ActiveWorkbook
For i = 1 To wb.Sheets.Count
Set ws = wb.Sheets(i)
.AutoFilterMode = False
With Range("f1", Range("f" & Rows.Count).End(xlUp))
.AutoFilter 1, "*$*"
On Error Resume Next
.Offset(1).SpecialCells(12).EntireRow.Delete
End With
.AutoFilterMode = False
Next i
I have the following coding in place
the problem I have is the coding does work and it removes the rows but it only works for the last worksheet and not all worksheets?Code:Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
'code
Next ws
Try this:
It should delete the first row in each worksheet of your active workbook.Code:Sub delRows()
Dim wb As Workbook
Dim ws As Worksheet
Dim i As Integer
Set wb = ActiveWorkbook 'or set to a specific workbook name
For i = 1 To wb.Sheets.Count
Set ws = wb.Sheets(i)
With ws
ws.Range("a1").EntireRow.Delete
MsgBox "deleted row 1 in sheet " & ws.Name
End With
Next i
End Sub
i think your problem need change to follow this code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
'code
Next ws