Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Please post this thread a complete correct method, method about te Nast Runsome New Users to Excel 0 February 23rd 08 09:42 PM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 4 June 6th 06 04:46 AM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 0 March 15th 06 10:34 AM
Need some help with Resize. Thanks John Wirt[_2_] Excel Programming 2 July 31st 03 08:37 AM


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"