troubleshooting Question

compile error variable not defined in macro

Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Excel
7 Comments3 Solutions505 ViewsLast Modified:
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

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros