Link to home
Start Free TrialLog in
Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland

asked on

compile error variable not defined in macro

Hi experts

I am trying to run the following macro and I am getting the msg as per subject box

vba code:
Sub Tidyup() Dim ws As Worksheet Dim i As Long For Each ws In Worksheets(Array("Daily Data", "MTD Data", "Weekly Data", "Monthly Data")) For i = ws.Range("B" & Rows.Count).End(xlUp).Row To Step -1 If ws.Range("B" & i) Like "DMX*" Then ws.Range("B" & i).Resize(, 30).Delete xlShiftUp End If Next i Next ws End Sub

Open in new window


on line .row to step -1
SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of route217

ASKER

Thanks fp
Avatar of [ fanpages ]
[ fanpages ]

No problem.

Credit to IrogSinta, though.  (S)he was here first! :)
Do you have a header row?
yes I do imnoire....in row 1 each sheet
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial