ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   relative columns (https://www.excelbanter.com/excel-programming/408763-relative-columns.html)

Helmut

relative columns
 
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.


Ivyleaf

relative columns
 
On Apr 3, 11:56*pm, Helmut wrote:
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).EntireColum n.delete

Cheers,
Ivan.


All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com