Hi,
I recorded a macro to do the following:
1. Delete Columns 'F' (Time) and 'G' (Room).
2. Insert new 'G' column with the title 'Time 1'
3. Insert new 'I' column with the title 'Time 2'
4. Insert new row number 1
5. Insert new row number 2
6. Fit cells to contents (Select all cells and double click border)
When I run the macro on a different sheet within the same workbook I get the following error
Run-time error '1004':
Method 'Range' of object'_Global' failed
Here is the VBA script that excel created:
Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+Shift+E
'
Columns("F:G").Select
Selection.Delete Shift:=xlToLeft
Columns("G:G").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("I:I").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("Table15[[#Headers],[Column1]]").Select
ActiveCell.FormulaR1C1 = "Time 1"
Range("Table15[[#Headers],[Column2]]").Select
ActiveCell.FormulaR1C1 = "Time 2"
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
End Sub
When I hit the 'Debug' button, it highlights
Range("Table15[[#Headers],[Column1]]").Select
Many thanks in advance and happy new year,
absconditus
PS I'm VBA-illiterate.
Bookmarks