Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro Help - Looping & Deleting
Hi, could someone please help me with this macro? It only works on the
active sheet when the "if" condition is met; otherwise it deletes all the columns to the right of column R. It does nothing to the other sheets. Sorry, I'll get better at this eventually. Thanks! ----- Sub DeleteColumnsAll() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets If InStr(Range("R2").Text, "Apple") Then Columns("AC:AW").Delete Else: Columns("S:AB").Delete End If Next ws End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping Macro | Excel Programming | |||
Looping macro | Excel Programming | |||
Looping and deleting thru cells which values offset | Excel Programming | |||
Deleting named ranges by looping through range collection | Excel Programming | |||
looping through range and deleting cell contents. | Excel Programming |