Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to select cells with values only (not empty ones)? | Excel Discussion (Misc queries) | |||
How to select cells with values only (not empty ones)? | Excel Discussion (Misc queries) | |||
select range between two empty cells? | Excel Programming | |||
how do i make a macro that will select all those cells that are empty | Excel Programming | |||
Select variably-sized range which contains empty cells | Excel Programming |