Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
JH JH is offline
external usenet poster
 
Posts: 64
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loop over columns kizzie Excel Discussion (Misc queries) 4 August 10th 05 01:31 PM
How to select columns in loop Bob Phillips[_7_] Excel Programming 0 January 18th 05 04:10 PM
loop through columns hotherps[_78_] Excel Programming 6 July 23rd 04 11:40 AM
Loop 20 columns Help! Michael168[_106_] Excel Programming 2 July 2nd 04 12:26 PM
select column cell in same row as loop result? john_t_h[_7_] Excel Programming 8 January 14th 04 06:21 AM


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"