Runtime Error 1004 Select method of Range class Failed
I used the macro recorder to generate this code which worked without
errors:
Sheets("Larry").Select
Columns("D:D").Select
Selection.ClearContents
Sheets("Harry").Select
Columns("D:D").Select
Selection.ClearContents
Range("C1").Select
So I generalized it to be this:
For Each ws In ThisWorkbook.Worksheets
strWsName = ws.Name
Worksheets(strWsName).Select
Worksheets(strWsName).Activate
Columns("D:D").Select
Selection.ClearContents
Next ws
But on the 2nd worksheet the Columns("D:D").Select gives me the
error in the Subject of this message.
Sugestions please! How do get Excel to run this without complaining?
BTW: Column D in this context is a message area.
|