Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to delete columns (not rows) within Row 1, that contain a blank
cell. I have examples of looping through the sheet, but not a specific row. The below deletes rows within a range. Can someone modify it for columns? Sub DeleteEmptyColumnRange() Dim DelRange As Range Dim c As Range For Each c In ActiveSheet.Range("A1:AK1").Cells If c.Value = 0 Then If DelRange Is Nothing Then Set DelRange = c.EntireRow Else Set DelRange = Union(DelRange, c.EntireRow) End If End If Next c 'turn on error handling in case no range is assigned On Error Resume Next DelRange.Delete On Error GoTo 0 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Delete blanks between a range and populate only the names inthe given range | Excel Discussion (Misc queries) | |||
Delete columns of a cell range | Excel Discussion (Misc queries) | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
How to Delete a Range in Closed Workbook (to Replace Delete Query) | Excel Discussion (Misc queries) | |||
Delete columns | Excel Programming |