Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Look for values into Ranges

Hi , I am using this formula for getting the last row with values

ws.Cells(Rows.count, rng.Column).End(xlUp).row

Now how can I look for some value in that range ?

Thank you in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Look for values into Ranges

Something like this perhaps. This macro finds the cell in the range from A2
down to the last entry in Column A. The value it is looking for is
"TheValue". HTH Otto
Sub FindValue()
Dim TheRng As Range
Dim TheFoundCell As Range
Set TheRng = Range("A2", Range("A" & Rows.Count).End(xlUp))
Set TheFoundCell = TheRng.Find(What:="The Value", LookAt:=xlWhole)
MsgBox TheFoundCell.Address(0, 0)
End Sub
"Angeles" wrote in message
...
Hi , I am using this formula for getting the last row with values

ws.Cells(Rows.count, rng.Column).End(xlUp).row

Now how can I look for some value in that range ?

Thank you in advance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Look for values into Ranges

It works !!!!

Thank you very much

:)

"Otto Moehrbach" wrote:

Something like this perhaps. This macro finds the cell in the range from A2
down to the last entry in Column A. The value it is looking for is
"TheValue". HTH Otto
Sub FindValue()
Dim TheRng As Range
Dim TheFoundCell As Range
Set TheRng = Range("A2", Range("A" & Rows.Count).End(xlUp))
Set TheFoundCell = TheRng.Find(What:="The Value", LookAt:=xlWhole)
MsgBox TheFoundCell.Address(0, 0)
End Sub
"Angeles" wrote in message
...
Hi , I am using this formula for getting the last row with values

ws.Cells(Rows.count, rng.Column).End(xlUp).row

Now how can I look for some value in that range ?

Thank you in advance.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Look for values into Ranges

Assuming that your variable rng.Column is equal to a valid column reference,
the row returned by your statement will be based on the last cell with data
in that column. So you can use that row as a reference by assigining it to a
variable like:

myLastRw = ws.Cells(Rows.count, rng.Column).End(xlUp).row

Now you can use that variable in a cell or range configuration like:

Cells(myLastRw, 1).Activate 'activates the cell on that row in col A.
Range("B2:B" & myLastRw).Select 'Selects cells in col B from B2 to that row.
Range("A1").Value = Cells(myLastRw, rng.Column).Value 'The value of the
cell that marked the row.

"Angeles" wrote:

Hi , I am using this formula for getting the last row with values

ws.Cells(Rows.count, rng.Column).End(xlUp).row

Now how can I look for some value in that range ?

Thank you in advance.

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
lookup on values between ranges The cat Excel Discussion (Misc queries) 8 April 22nd 09 03:00 PM
Two Ranges, Spot Different Values Neal Zimm Excel Programming 1 January 31st 07 11:45 PM
Two Ranges, Spot Different Values Neal Zimm Excel Programming 0 January 31st 07 11:44 PM
Sumproduct values from two ranges Steven Cheng Excel Worksheet Functions 4 September 17th 06 03:06 AM
compare values in 2 ranges Martin Wheeler Excel Programming 10 March 22nd 05 10:14 PM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"