ChocksterNo1
New Member
- Joined
- Mar 22, 2011
- Messages
- 24
Hi
I have part of this macro that delete row if cell value = 0 (as shown below)
Dim rng As Range, cell As Range, del As Range
Dim strCellValue As String
Set rng = Intersect(Range("C:C"), ActiveSheet.UsedRange)
For Each cell In rng
strCellValue = (cell.Value)
If InStr(strCellValue, "0") > 0 Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete
This only works on 1 worksheet, I have 4 or 5 other worksheets that I need to apply this macro to. If I attach it to the parts for the other worksheets i get the message
compile error: Duplicate declaration in current scope.
was hoping someone could help me.
thanks
Chock
I have part of this macro that delete row if cell value = 0 (as shown below)
Dim rng As Range, cell As Range, del As Range
Dim strCellValue As String
Set rng = Intersect(Range("C:C"), ActiveSheet.UsedRange)
For Each cell In rng
strCellValue = (cell.Value)
If InStr(strCellValue, "0") > 0 Then
If del Is Nothing Then
Set del = cell
Else: Set del = Union(del, cell)
End If
End If
Next cell
On Error Resume Next
del.EntireRow.Delete
This only works on 1 worksheet, I have 4 or 5 other worksheets that I need to apply this macro to. If I attach it to the parts for the other worksheets i get the message
compile error: Duplicate declaration in current scope.
was hoping someone could help me.
thanks
Chock