Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select columns in loop
When a row is deleted, it is deleted for all columns.
If you want anything other than that, you can do it with one command ActiveSheet.Cells.SpecialCells(xlblanks).Delete If you have more than 8192 discontiguous areas, then you might need a work around. -- Regards, Tom Ogilvy "JH" wrote in message ... Dear experts, please I need to help with following problem: I 've got in a worksheet 10 columns. Start A1. I'd like to remove empty cells in each column. to remove empty cells I use following: Sub delEmptyrow() LastRow = ActiveSheet.UsedRange.Row - 1 + _ ActiveSheet.UsedRange.Rows.Count For r = LastRow To 1 Step -1 If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete Next r End Sub this work fine but just for one column I don't know how to select each column separately in loop in order to use "my Sub" actually, how to replace this notation range("A:A") thanks JH |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to select columns in loop
Thanks you
:) JH "Tom Ogilvy" wrote: When a row is deleted, it is deleted for all columns. If you want anything other than that, you can do it with one command ActiveSheet.Cells.SpecialCells(xlblanks).Delete If you have more than 8192 discontiguous areas, then you might need a work around. -- Regards, Tom Ogilvy "JH" wrote in message ... Dear experts, please I need to help with following problem: I 've got in a worksheet 10 columns. Start A1. I'd like to remove empty cells in each column. to remove empty cells I use following: Sub delEmptyrow() LastRow = ActiveSheet.UsedRange.Row - 1 + _ ActiveSheet.UsedRange.Rows.Count For r = LastRow To 1 Step -1 If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete Next r End Sub this work fine but just for one column I don't know how to select each column separately in loop in order to use "my Sub" actually, how to replace this notation range("A:A") thanks JH |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
loop over columns | Excel Discussion (Misc queries) | |||
How to select columns in loop | Excel Programming | |||
loop through columns | Excel Programming | |||
Loop 20 columns Help! | Excel Programming | |||
select column cell in same row as loop result? | Excel Programming |