=LOOKUP(9.99999999999999E+307,A:A)
will display the last numeric entry from column A.
If column A houses text values...
=LOOKUP(REPT("z",255),A:A)
will display the last text entry from column A.
=LOOKUP(9.99999999999999E+307,1/(A:A=""),A:A)
returns any last value, except a blank. Should not be used if one of the foregoing would apply.
Hi Aladin thanks for your reply, I was hoping my original post would include an image to give all the relevant information but it didn't so I will try to explain what I am doing.
I have a user form that has a text box and the text entered is used to search the spread sheet, what I have upto now works great but it returns the first entry.
Private Sub CommandButton1_Click()
Dim machine As String
Dim heatmod As String
Dim dat As String
machine = TextBox1.Text
dat = Application.WorksheetFunction.VLookup(machine, Range("$A:$C"), 1, False)
heatmod = Application.WorksheetFunction.VLookup(machine, Range("$A:$C"), 3, False)
MsgBox dat & " " & machine & " heat mod done " & " = " & heatmod
End Sub
When I search 161122002042 I receive the message "161122002042 heat mod done = No" I would like it to say Yes.
[TABLE="width: 164"]
<colgroup><col width="115" style="width: 86pt; mso-width-source: userset; mso-width-alt: 4205;"> <col width="104" style="width: 78pt; mso-width-source: userset; mso-width-alt: 3803;"> <tbody>[TR]
[TD="class: xl65, width: 115, bgcolor: transparent"]
Machine Number[/TD]
[TD="class: xl65, width: 104, bgcolor: transparent"]
Heat Mod Done[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002040[/TD]
[TD="class: xl65, bgcolor: transparent"]
Yes[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002041[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: yellow"]
161122002042[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002043[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002044[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002045[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: yellow"]
161122002042[/TD]
[TD="class: xl65, bgcolor: transparent"]
Yes[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002047[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002048[/TD]
[TD="class: xl65, bgcolor: transparent"]
Yes[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
161122002049[/TD]
[TD="class: xl65, bgcolor: transparent"]
No[/TD]
[/TR]
</tbody>[/TABLE]