View Single Post
  #4   Report Post  
Shafiee
 
Posts: n/a
Default

You can do it with macro too... Try recording it. That is the easiest way.
And then you can modify it so that the user won't see cells being selected by
the macro. Here is what you have to do.

Select Tools - Macros - Record New Macro and then click ok
Select the index column
Press Ctrl + F
Type an index number
Click the stop button


By doing that, you'll get a macro like this:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/28/2005 by Shaafee
'

'
Columns("A:A").Select
Selection.Find(What:="4", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
End Sub


Now change the macro like this:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/28/2005 by Shaafee
'

'

Dim idx
idx = Sheets("Sheet1").Columns("A:A").Find(What:=InputBo x("Please enter
the index number", "Index Prompt", 1), After:=Range("A1"),
LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Value
MsgBox Sheets("Sheet1").Range("B" & idx).Value
Set idx = Nothing
End Sub


Now you might want to put the data in another cell of another sheet.
Just change the second last line to:

Sheets("Sheet2").Range("A1").Value = Sheets("Sheet1").Range("B" & idx).Value