Thread
:
Inserting columns
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett[_4_]
external usenet poster
Posts: 2,337
Inserting columns
try this but you really don't have to use the active cell.
Sub inserttwocolums()
x = ActiveCell.Row
y = ActiveCell.Column
Range(Cells(x, y), Cells(x, y + 1)).EntireColumn.Insert
End Sub
--
Don Guillett
SalesAid Software
"FinChase" wrote in message
...
I have a number of spreadsheets where I need to go through and insert two
columns at 26 places in each spreadsheet. I'm trying to make this a
little
faster by writing a VBA macro that I can run with keystrokes. What I
tried
to do was tell it select the column that I am currently in and insert two
columns to the right of that column. The problem I am having is that it
is
inserting the columns to the left instead of the right. I can't figure
out
why. Here's the code I've written:
With ActiveCell
.EntireColumn.Select
End With
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Any help would be appreciated.
Reply With Quote
Don Guillett[_4_]
View Public Profile
Find all posts by Don Guillett[_4_]