Making a change in all worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to delete a column in all worksheets. The code i'm using only
deletes the column in the first worksheet, but not the rest of them.

Dim sht As Worksheet
For Each sht In ThisWorkbook.Worksheets
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Next sht

Any help would be greatly appreciated.
 
Try this...

Dim sht As Worksheet
For Each sht In ThisWorkbook.Worksheets
sht.Columns("D:D").Delete Shift:=xlToLeft
Next sht
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top