relative columns

H

Helmut

Hi, I have this macro:

Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveCell.Range("A1:Y1").Select
Selection.EntireColumn.Delete
Selection.EntireRow.Delete

there are A1 and B1 with a value and then say X1 with a value. In between
Cells are blank. The inbetween changes...i.e. next months its not X1, its Z1
or AA1.
I have to delete the columns where the Cells are blank...i.e. C1 to W1 or Z1
and then delete the entire row.
 
I

Ivyleaf

Hi, I have this macro:

    Range("C1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    ActiveCell.Range("A1:Y1").Select
    Selection.EntireColumn.Delete
    Selection.EntireRow.Delete

there are A1 and B1 with a value and then say X1 with a value. In between
Cells are blank. The inbetween changes...i.e. next months its not X1, its Z1
or AA1.
I have to delete the columns where the Cells are blank...i.e. C1 to W1 or Z1
and then delete the entire row.

Hi Helmut,

If you are just looking to delete all columns where the cells in row 1
are blank:

Rows(1).SpecialCells(xlCellTypeBlanks).EntireColumn.delete

Cheers,
Ivan.
 

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