I have this routine which basically does some simple formatting by copying and pasting a row and then AutoFitting the contents of the selected sheets.
It keeps crashing with an "Object Defined Error" 1004.
My fear is that it does not like the selecting of a cell when more than one sheet is selected.
Please help me figure it out...
BTW... I am switching .ScreenUpdating on and off in routines prior to this...Could that generate an object error?
Thanks,
Tweek
It keeps crashing with an "Object Defined Error" 1004.
My fear is that it does not like the selecting of a cell when more than one sheet is selected.
Please help me figure it out...
BTW... I am switching .ScreenUpdating on and off in routines prior to this...Could that generate an object error?
Thanks,
Tweek
Code:
Sub Fmt_Exclm()
Sheets("IP Runner Log").Select
Rows("2:2").Select 'selects "to be" format row
Selection.Copy 'copies format row
SelShts 'selects all ! sheets
Range("A1").'***CRASHES HERE***
ActiveSheet.Paste 'pastes format row
Cells.Select 'selects all cells in sheet
Selection.Columns.AutoFit 'autofits all columns in sheets with !
Sheets("IP Runner Log").Select
End Sub
Code:
Sub SelShts()
s = ""
For Each ws In Worksheets
If ws.Name Like "!*" Then s = s & Chr(1) & ws.Name
Next ws
Sheets(Split(Mid(s, 2), Chr(1))).Select
End Sub