Userform
Sure, anything that you do in VBA can be done in a
userform....pretty much everything. But why use a
userform?
A simple User Defined Function will return the value
Function GetDistance(PlaceA As String, _
PlaceB As String) As Variant
Dim target As Range
Dim ResultRow As Long
Dim ResultCol As Long
' find the row of the first place
Set target = Range("A:A").Find(PlaceA)
If target Is Nothing Then
GetDistance = PlaceA & " not found."
Else
' save the row
ResultRow = target.Row
' find the second place
Set target = Range("1:1").Find(PlaceB)
If target Is Nothing Then
GetDistance = PlaceB & " not found."
Else
ResultCol = target.Column
End If
End If
If ResultRow 0 And ResultCol 0 Then
GetDistance = Cells(ResultRow, ResultCol)
End If
End Function
-----Original Message-----
Hello from Steved
Question can a userform be built so it can run a query
Example the query would be to find in Column A1
Riccarton
(Column A29), and in Row 1A Hornby (Row 1G). The result
would be that it would end up with the answer in G29 ie
15.6 Kilometres
Thanks in Advance
.
|