Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime Error 1004 Select method of Range class Failed
Hi IanO,
It is rarely necessary or desirable to make physical selections. The following code worked for me: Sub Tester() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Columns("D:D").ClearContents Next ws End Sub --- Regards, Norman "IanO" wrote in message oups.com... 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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Runtime Error 1004 Select method of Range class Failed
Thanks Norman.
IanO |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Runtime 1004 error -- insert method of range class failed. | Excel Discussion (Misc queries) | |||
RUNTIME ERROR '1004' --- Select method of worksheet class failed | Excel Programming | |||
runtime error '1004' delete Method of Range Class Failed | Excel Programming | |||
Runtime Error "1004" Select Method of Range Class Failed | Excel Programming | |||
excel97: runtime error 1004 select method of range class failed | Excel Programming |