Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Select a range not equal to:

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Select a range not equal to:

James: I appreciate you taking a stab at it.
What we're looking for it to return is the cells that are not ""

In this case, the range to evaluate is P54:P68. The results that actually return a value are P54:P64 in this instance. Wouild like to select that range. (P65:P68 return the "")

Maybe that would help?

Thanks.
Pete


On Thursday, June 28, 2012 11:50:04 AM UTC-5, James Ravenswood wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 143
Default Select a range not equal to:

How about:


Sub NotBlanks()
Dim rA As Range, rSmaller As Range
Set rA = Range("P54:P68")
For L = 68 To 54 Step -1
If Cells(L, "P").Value < "" Then
Exit For
End If
Next
Set rSmaller = Range("P54:P" & L)
MsgBox rSmaller.Address
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 16
Default Select a range not equal to:

Thanks once again James.

Can the macro select the range instead of identifying it? Don't need the message box (The range, however identified and displayed the correct cells.)

Pete

On Thursday, June 28, 2012 2:31:41 PM UTC-5, James Ravenswood wrote:
How about:


Sub NotBlanks()
Dim rA As Range, rSmaller As Range
Set rA = Range("P54:P68")
For L = 68 To 54 Step -1
If Cells(L, "P").Value < "" Then
Exit For
End If
Next
Set rSmaller = Range("P54:P" & L)
MsgBox rSmaller.Address
End Sub


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
Setting a .Range to equal another .Range kittronald Excel Programming 5 October 17th 11 10:30 PM
Select rows equal to filter and highlight row JohnM Excel Programming 4 August 30th 09 12:48 PM
Macro to select a list of values greater than or equal to a value DOOGIE Excel Programming 9 April 25th 07 11:04 AM
Select from List of names to equal a specific rate Shirley Excel Worksheet Functions 3 December 20th 05 05:29 PM
How do I select a range if one cells contents is equal to another KHarrison Excel Discussion (Misc queries) 2 December 20th 04 09:35 PM


All times are GMT +1. The time now is 11:18 PM.

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"