Hi
I haven't used webforms, so that is beyond me. However, assigning the values to a bunch of variables is easy.
Is there a relationship between the Number and the row number, or will we have to search? I have assumed there is no relationship and I have searched for it. It may be possible to go straight to the row by setting the row as N-5, or similiar, if there is a relationship.
I have assumed the number is in column A.
Sub GetNumber()
Dim n, lr As Single, sRow As Single
'Number Name Address City State ZIP Phone
Dim stName As String, stAdd As String, stCity As String
Dim stState As String, stZip As String, stPhone As String
n = InputBox("Enter a number", "Number")
If n = "" Then Exit Sub
n = Val(n)
If n = 0 Then Exit Sub
'Find used range (last row)
lr = ActiveSheet.Range("A50000").End(xlUp).Row
'Check down column 1 for value n. Column 1 = Column A.
stName = ""
For sRow = 1 To lr
If Cells(sRow, 1) = n Then
stName = Cells(sRow, 2).Value
stAdd = Cells(sRow, 3).Value
stCity = Cells(sRow, 4).Value
stState = Cells(sRow, 5).Value
stZip = Cells(sRow, 6).Value
stPhone = Cells(sRow, 7).Value
Exit For
End If
Next sRow
If stName = "" Then
MsgBox "Not Found"
Else
MsgBox "Found " & stName
'Send it to the webform Subroutine(stName, stAdd,stCity,stState,stZip,stPhone)
End If
End Sub
Hope some of this helps.
Cheers, Rob.
Bookmarks