Excel 2000 Deleting Column A

  • Thread starter Thread starter scain2004
  • Start date Start date
S

scain2004

I'm trying to remove the first column (column "A") from the worksheet.

Nothing seems to be working.

I try:

Columns("A:A").Select
Selection.Delete

..but that deletes columns A and B.

And if I shift the cells one column to the left:

Columns("B:O").Select
Selection.Cut
Columns("A:N").Select

...nothing happens

If I manually do it, it works fine. But if I record and save it as
macro, when called the macro won't do what it's supposed to.


Any suggestions? I only want column A deleted, but it has to be don
automatically... at the end of my current routine
 
I'm struggling to make Columns("A:A").Delete do anything but delete Col A. Are
you sure you don't have this in your code twice in some way, so that it deletes
Col A twice giving the impression of deleting Col A and B?
 
Ok, I tried Range("A1").EntireColumn.Delete but it did the same thing.
I know it's not in the code more than once and it's not part of th
previous for loop so I don't know why it's deleting both the A and th
B columns
 
Do you have any merged cells in column A (that extend into column B)?

Different versions of excel treat this kind of thing differently. IIRC, xl97
wanted to delete both columns.

xl2002 deletes the single column.

You could check to see if there were merged cells in column A first.

Option Explicit
Sub testme()

Dim testMerge As Variant
testMerge = Range("a1").EntireColumn.MergeCells
If testMerge = False Then
Range("a1").EntireColumn.Delete
Else
MsgBox "get rid of merged cells and try again!"
End If

End Sub
 
OK, you got me curious now - Any chance you could fire me down a copy of the
workbook so I can try this out?

ken.wright at NOSPAM ntlworld.com - remove the obvious
 
Your code as supplied is correct, although it could simplified to

Columns("A").Delete

I suspect somewhere in your code you are running this twice, which would
give the effect of deleting column A and B,
try putting a breakpoint after the line that deletes column A, the macro
will stop and you can inspect if it is running twice?

Cheers
Nigel
 

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

Back
Top