Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How would I make the result row of a lookup the active row ?

Hello all:
Relatively new to Excel, so I hope this question isn't one that could
be answered in Excel 101.

I have a situation where I would like to determine if a particular
'Case No.' (key column) is in a table; if so, make that row the
active row. If not, then give some sort of message saying that the
Case No. couldn't be found.

I've tried several methods of validating the fact that the number
exist and returning its row index in the table. What I've not found
via ordinary functions and/or do not know how to do, is to take the
returned info and navigate the cursor to the desired row in the
table.

What I've done:

A10:D10 - Table Column Headings (Case No., Name, Date, Comment)
A11:D65356 - Possible Table Range
A11:A65356 - 'CaseNo' Range

Sample Table:
Case No. Name Date Comment
123 Joe Blow 1/1/2006 This is a comment
4354 Jane Jones 2/15/2006 Another comment
48314 H. Braddock 2/24/2006 Yet another comment
..
Some of the things I've done to insure the validity of what I want to
do.

C3 - Used as input for the case Number to look for.
D3 - Formula to get the row within the table ( = Match(C3,CaseNo,0) )
E3 - Another formula to ensure that I'm getting data
(=Index(CaseNo,D3)

What I've not been able to find is a way to move the cursor to the
location within the table for the returned info.

Sorry for such a long post, but wanted to provide as much info as
possible. Thanks in advance for any help.

Jim



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default How would I make the result row of a lookup the active row ?

Hi Jim

You can dedicate a cell to trigger the search
In this case cell a1 but you can make it any cell you want

For i = 11 To Rows.Count
If Cells(i, 1) = Cells(1, 1) Then
Cells(i, 1).EntireRow.Select
Exit Sub
End If
Next i
MsgBox prompt:="The Case No. could not be found"

Or with an Inputbox triggered by a button


Private Sub CommandButton1_Click()
Dim CaseNo
CaseNo = Application.InputBox("Input Case No")
For i = 11 To Rows.Count
If Cells(i, 1).Text = CaseNo Then
Cells(i, 1).EntireRow.Select
Exit Sub
End If
Next i
MsgBox prompt:="The Case No. could not be found"

End Sub

I hope this answeres your question

Cheers Christian

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default How would I make the result row of a lookup the active row ?

That should be

Private Sub Worksheet_Change(ByVal Target As Range)
For i = 11 To Rows.Count
If Cells(i, 1) = Cells(1, 1) Then
Cells(i, 1).EntireRow.Select
Exit Sub
End If
Next i
MsgBox prompt:="The Case No. could not be found"

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How would I make the result row of a lookup the active row ?



Christian wrote:
That should be

Private Sub Worksheet_Change(ByVal Target As Range)
For i = 11 To Rows.Count
If Cells(i, 1) = Cells(1, 1) Then
Cells(i, 1).EntireRow.Select
Exit Sub
End If
Next i
MsgBox prompt:="The Case No. could not be found"

End Sub


Christian:

I've tried your first suggestion and it works exactly like what I
want
to happen. Have not tired the above, but will.

I thank you so very much for the input. This just shows that I need
to
hit the books and learn a little vba. Again, thank you!!

Jim


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 help. lookup result based on data in 2 columns lcc Excel Worksheet Functions 3 April 6th 10 01:20 PM
VLookup result to be an active hyperlink Kapplox Links and Linking in Excel 1 January 18th 07 04:30 PM
Join 2 Lists - Lookup value in 1 list & use result in 2nd lookup JBush Excel Worksheet Functions 3 January 3rd 07 11:14 PM
How to make only the cells i need active debs1389 Excel Worksheet Functions 3 May 13th 06 07:49 PM
Make a particular cell the active one Newbie Excel Programming 3 April 14th 04 04:52 PM


All times are GMT +1. The time now is 05:39 PM.

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"