D
Domenic
I was given the following code by Dave Peterson which is suppose to
delete the same columns on every sheet within a workbook.
Unfortunately, when I run the macro it doesn't behave as it should.
Dave feels that the code should work on a Mac and doesn't understand why
it doesn't.
So we're wondering if anyone else has the same problem, or whether the
code runs as it should on other Macs.
Here's the code I'm using...
Option Explicit
Sub deletecols()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Range("a1:c1,m1:q1").EntireColumn.Delete
Next
End Sub
When I run it, it deletes columns starting from Column S (I have data
from Columns A to Column Z on three sheets), not the columns stated in
the code (Columns A to C and Columns M to Q).
And when I change the range to the following, I get the corresponding
results:
Range("a1:c1") ---> Columns X, Y, and Z deleted
Range("a1") ---> Column Z deleted
Anyone else get the same results?
delete the same columns on every sheet within a workbook.
Unfortunately, when I run the macro it doesn't behave as it should.
Dave feels that the code should work on a Mac and doesn't understand why
it doesn't.
So we're wondering if anyone else has the same problem, or whether the
code runs as it should on other Macs.
Here's the code I'm using...
Option Explicit
Sub deletecols()
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
sh.Range("a1:c1,m1:q1").EntireColumn.Delete
Next
End Sub
When I run it, it deletes columns starting from Column S (I have data
from Columns A to Column Z on three sheets), not the columns stated in
the code (Columns A to C and Columns M to Q).
And when I change the range to the following, I get the corresponding
results:
Range("a1:c1") ---> Columns X, Y, and Z deleted
Range("a1") ---> Column Z deleted
Anyone else get the same results?