Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Select non empty cells

Hi guys/gals

I want to select (VBA) the non empty cells within a given range, like
given a1:c4 only the cells below, that are non empty, will be
selected. I tried combinations of intersect with specialcells but
unsuccessfully.

a1 c1
b2
a3 c3
a4b4

Thanks for your time,
Mika

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 373
Default Select non empty cells

Mika, I can't remember who in this newsgroup came up with this little gem.
But it was so clever that I remembered it and I'll pass it on to you! James

Sub Sel()
Dim rgStr As String, c As Range
For Each c In Range("a1:c5")
If c < "" Then
If rgStr = "" Then
rgStr = c.Address
Else
rgStr = rgStr & "," & c.Address
End If
End If
Next c
Range(rgStr).Select
End Sub

"Mika" wrote in message
oups.com...
Hi guys/gals

I want to select (VBA) the non empty cells within a given range, like
given a1:c4 only the cells below, that are non empty, will be
selected. I tried combinations of intersect with specialcells but
unsuccessfully.

a1 c1
b2
a3 c3
a4b4

Thanks for your time,
Mika



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Select non empty cells

Thanks,

It does the trick for small ranges but not for big ones, when the
string exceeds excel max size, but I think I can find the workaround.
Still, it should be great if it could be done without checking every
cell using in built functions... ah well...

thanks
mika

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
How to select cells with values only (not empty ones)? nick Excel Discussion (Misc queries) 4 December 20th 06 09:07 PM
How to select cells with values only (not empty ones)? nick Excel Discussion (Misc queries) 1 December 20th 06 06:03 PM
select range between two empty cells? leonidas Excel Programming 5 June 14th 06 08:12 AM
how do i make a macro that will select all those cells that are empty VB Script for Excel Excel Programming 2 April 27th 06 09:06 AM
Select variably-sized range which contains empty cells Jean[_4_] Excel Programming 11 August 23rd 05 06:51 AM


All times are GMT +1. The time now is 01:11 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"