Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default select cell with value

Hi ladies and gents

I have a question:
How can i lookup a value in a range then select the cell that value

Thanks for the help
Ernie

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default select cell with value

Ernie,

Have you tried find?

This is also available in VB if you want to write a macro for it.
--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"ernie" wrote:

Hi ladies and gents

I have a question:
How can i lookup a value in a range then select the cell that value

Thanks for the help
Ernie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,365
Default select cell with value

Presumably you want to do this in VBA code?

Here's a basic (meaning primitive, not Basic) routine that you could modify
to meet your specific needs. Note that if what you are trying to Find is not
in the list, then an error is generated, which this code takes care of, but
in this case if no match is found then the entire range will remain
highlighted/selected. You also need to be on the sheet where the search is
to be performed before running this macro. Since you said you wanted to
select the found item, I used .Select initially rather than just doing a
search in a virtual range.

Sub SimpleFind()
Dim toBeFound As Variant
'you can use code to
'determine the range
'and use a variable
'instead of fixed range
Range("D1:D9").Select
'you could get value to
'search for from user or
'from another cell
toBeFound = 77
On Error Resume Next ' errors if no match
Selection.Find(What:=toBeFound, _
After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Select
If Err < 0 Then
Err.Clear
End If
On Error GoTo 0
End Sub


Basic steps:
define/select the range to be searched

"ernie" wrote:

Hi ladies and gents

I have a question:
How can i lookup a value in a range then select the cell that value

Thanks for the help
Ernie

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
VBA: Column Select then Data Select then return to cell A1 James C[_2_] Excel Discussion (Misc queries) 3 February 1st 10 11:35 AM
Using formulas to select cells (Ex: Select every nth cell in a col Lakeview Photographic Services Excel Discussion (Misc queries) 2 March 15th 07 02:17 PM
How do I select multiple selections using the range(cell(),Cell()) havocdragon Excel Programming 1 November 8th 06 05:02 PM
How to point to (select) a cell to the left from a cell where I enter the = equal sign? Dmitry Excel Discussion (Misc queries) 4 June 30th 06 06:49 AM
Select cell, Copy it, Paste it, Return to Previous cell spydor Excel Discussion (Misc queries) 1 December 30th 05 01:29 PM


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

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"