View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
James Ravenswood James Ravenswood is offline
external usenet poster
 
Posts: 143
Default Select a range not equal to:

On Wednesday, June 27, 2012 3:48:15 PM UTC-4, Pete wrote:
Want to use VBA to select and copy a range that includes only the cells not
returning: "".

The formulas in the cells/range evaluated either calculate and return a value, or return a "" (from the formula)
The cells returning "" are always at the bottom of the range, while the cells returning data are on top.

Just want to highlight the results so as to copy them into another application.

TIA for any ideas.

Pete


How about:

Sub NotBlanks()
Dim rA As Range, rSmaller As Range
Set rA = Range("A1:A100")
For L = 100 To 1 Step -1
If Cells(L, 1).Value < "" Then
Exit For
End If
Next
Set rSmaller = Range("A1:A" & L)
MsgBox rSmaller.Address
End Sub