View Full Version : Look up for a value in a worksheet and store it in a variable
cdefranc
01-16-2012, 02:50 PM
Hi ,
i want to look up for a value which can be in a column range and store it in a variable for further use . How can i do it?
thanks, Carlo
mikerickson
01-16-2012, 02:58 PM
More detail is needed.
What value is being sought?
What do you want to do if it isn't in the column?
"store it for further use":
1) store it where? what future use?
2) if we know the value at the beginning, why look in the column, why not just store it without looking?
Bob Phillips
01-17-2012, 01:42 AM
If you just want to check if that value is there, try something like
Dim cell As Range
Set cell = Columns(1).Find("XYZ")
If cell Is Nothing Then
MsgBox "Not found"
Else
MsgBox "Found in row " & cell.Row
End If
cdefranc
01-17-2012, 03:32 PM
first of all, thank you both :rotlaugh:
then some clarifications for mikerikson :
i want to store the result of the search in a variable as i need to verify whether that value has already been assigned in the cell 'x' of a specific row; this string value is already present in a cell of the row but has to be stored , given certain conditions , in the cell x to produce an encoding that will be used furthermore in another program :banghead: .
Since i'm trying to apply also other controls , by now i'm working on the first part of the development (very useful your post xld), than i'll be very glad if you could help me later on .
Bye guys!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.