Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
resize method
I have written the following code and I keep getting a run
time error 1004. Can anyone help? Sub ResizeIT() Dim range1 As Range Dim range2 As Range Set range1 = Worksheets("UnitTemplate").Range("CS7") Set range2 = range1 Range("range1").Resize(, 3).Select Selection.EntireColumn.Insert End Sub I am just trying to insert some columns based on a set range address. Tim McPhillips |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
resize method
Tim,
Is the UnitTemplate sheet active when you try to Resize and Select the range? You can only select cells on the active sheet. Use Worksheets("UnitTemplate").Activate to activate the sheet before doing the Select. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tim McPhillips" wrote in message ... I have written the following code and I keep getting a run time error 1004. Can anyone help? Sub ResizeIT() Dim range1 As Range Dim range2 As Range Set range1 = Worksheets("UnitTemplate").Range("CS7") Set range2 = range1 Range("range1").Resize(, 3).Select Selection.EntireColumn.Insert End Sub I am just trying to insert some columns based on a set range address. Tim McPhillips |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
resize method
Tim
Use range1.Resize(,3).EntireColumn.Insert Range("range1") doesn't work because Excel is looking for a named range called range1. Since you've dimmed it as a range, you can use it as above. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "Tim McPhillips" wrote in message ... I have written the following code and I keep getting a run time error 1004. Can anyone help? Sub ResizeIT() Dim range1 As Range Dim range2 As Range Set range1 = Worksheets("UnitTemplate").Range("CS7") Set range2 = range1 Range("range1").Resize(, 3).Select Selection.EntireColumn.Insert End Sub I am just trying to insert some columns based on a set range address. Tim McPhillips |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
resize method
Tim
Sub ResizeIT() Dim range1 As Range Dim range2 As Range Set range1 = Worksheets("UnitTemplate").Range("CS7") Set range2 = range1 range1.Resize(, 3).Select Selection.EntireColumn.Insert End Sub Regards Trevor "Tim McPhillips" wrote in message ... I have written the following code and I keep getting a run time error 1004. Can anyone help? Sub ResizeIT() Dim range1 As Range Dim range2 As Range Set range1 = Worksheets("UnitTemplate").Range("CS7") Set range2 = range1 Range("range1").Resize(, 3).Select Selection.EntireColumn.Insert End Sub I am just trying to insert some columns based on a set range address. Tim McPhillips |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please post this thread a correct full method, method about | New Users to Excel | |||
Please post this thread a complete correct method, method about te | New Users to Excel | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
I could NOT resize the axis title but excel allows me to resize gr | Charts and Charting in Excel | |||
Need some help with Resize. Thanks | Excel Programming |