VLOOKUP in a macro

B

Barney

In Excel 2002 using and an InputBox I want to input an ID#, then find that
ID# in a VLOOKUP table, then using the InputBox, enter a score (Points) in
the cell next to (right of) the ID# in the table.

I am trying this to no avail:

Sub PointsInput()
'
' PointsInput Macro
' Macro recorded 1/10/2008 by Barney
'

'
Range("C2").Select
ActiveCell.FormulaR1C1 = _
InputBox("Enter ID#")
Range(VLOOKUP(C2,C4:C1000,2).Select
InputBox("Enter Points")

End Sub

Also, how do I make the Input Box remain active while I loop through 120
ID#'s and Points so that I don't need to continually select a macro button?

Thanks in advance

Barney
 
D

Don Guillett

It's not clear to me but it seems as if you have a list. Put your score in
the next column
 
D

Don Guillett

Hit send too soon
a b c d
num score
1 a 3 c
2 b 2 b
3 c 1 a

Sub putscore()
For Each c In Range("a2:a4")
Columns(3).Find(c).Offset(, 1) = c.Offset(, 1)
Next c
End Sub
 
B

Barney

Actually, I have the ID numbers (1 thru 1000) in a column. Only 120 of
those 1000 will get a score beside them and I am never sure which 120 that
will be. I don't want to have to scroll to each number as time is critical.
Hence the input box, VLOOKUP, and the macro.

Barney
 
D

Don Guillett

How do the scores get there?
On the macro presented if there was no score beside it then, of course, it
would not be assigned. Try it.
Send me a workbook to my address below, if desired.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top