Home > Enterprise >  How to insert a column in Excel using VBA?
How to insert a column in Excel using VBA?

Time:05-06

Please help me with the code to insert a column in excel using vba. Here is what I am doing -


Sheet1.Range("A:A").EntireColumn.insert

CodePudding user response:

I think you got the Sheets property wrong, this works for me :

Sheets(1).Range("A:A").EntireColumn.Insert

CodePudding user response:

You should clearly mention what you are trying to do; what type of problem you are facing.

However, you should try out the below code. hope this will help

Sheet1.Range("A:A").EntireColumn.Insert Shift:=xlToRight

while inserting a new row or column make sure to refer to the entire row or column. Check if there are any marge cells at the right of column A. That can possibly be causing the problem.

  • Related