resizing a range

T

tim mcphillips

I can't the following code to work. I am trying to resize
a range so I can insert columns.

Sub ResizeIT()
Dim range1 As Range
Dim range2 As Range
Set range1 = Worksheets("UnitTemplate").Range("CS7")
Set range2 = range1
Worksheets("UnitTemplate").Range("range1").Resize(0,
3).Select
Selection.EntireColumn.Insert
End Sub

Any help would be appreciated!
 
M

Michael Malinsky

Try this:

Sub ResizeIT()

'Inserts 3 columns into worksheet at cell CS7

Worksheets("Sheet1").Range("CS7").Activate
Selection.Resize(1, 3).Select
Selection.EntireColumn.Insert

End Sub


HTH

Michael J. Malinsky
 
M

Myrna Larson

As for why the present code doesn't work, you can't resize to 0 rows (or 0 columns). Does it
work if you change the 0 to a 1?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top