Visual Basic, Insert a column into Excel - TechRepublic
General discussion
July 29, 2004 at 07:35 AM
ramoore

Visual Basic, Insert a column into Excel

by ramoore . Updated 21 years, 11 months ago

I writing a VB program that inserts a column of cells into an existing Excel worksheet with a specified range (e.g. “A1:A20”). After the column is inserted, each cell up to row 20 is filled with a text string.
How can I insert a column of cells without specifying the range? In other words, I would like to fill each cell in the new column and stop when it reaches the last row of data in the other existing columns. Any help is appreciated!

‘specify a range of cells and fill with text
Selection.Insert
Range(“A1:A20”).Value = “MY TEXT”

This discussion is locked

All Comments