Adding Columns in Excel 2007 (2003 Compatibility Mode)

A

AndyJ

both Please advise,

I am trying to add columns as per the following code:

Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove

When i check the worksheet, columns A and B have been selected,

If I run the following code:

Columns("C:C").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove

only Column C is selected.

Can anyone help?
 
D

Dave Peterson

I didn't start xl2007, but different versions of excel treat merged cells
differently.

Do you have any cells in A:B that are merged?
 
A

AndyJ

Cheers Dave,

I didnt consider that!.

I have been writing in VB.NET and not VBA for the last couple of years and
have forgotten some simple checks.

Thanks for your help.
 

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