MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Selecting non-blank cells but not formula in several columns via VBA


Posted by olivier on February 09, 2002 12:57 PM

I would like to select non-blanks cells in several columns but avoid the formulas like if A3=("","",do calculation)

Thanks for your help


Posted by Mark W. on February 09, 2002 12:59 PM

Selection.SpecialCells(xlCellTypeConstants, 23).Select

Posted by Olivier on February 09, 2002 2:40 PM

Mark - Thanks for your help

I tried your solution but it does not work; I think I don't know where to add your line in that procedure

Thanks for your time

Sub SelectColumns1()
Dim col As Range
Set col = Cells(Rows.Count, "A").End(xlUp)
Range("A1", col).Resize(, 2).Select
End Sub

Posted by Mark W. on February 09, 2002 2:46 PM

Just make your cell selection (e.g., A:C)
and execute the statement...

Selection.SpecialCells(xlCellTypeConstants, 23).Select

Posted by Olivier on February 09, 2002 3:16 PM

I got it; thanks for the follow-ups