Thread: Operator
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Bundy John Bundy is offline
external usenet poster
 
Posts: 93
Default Operator

Thought I posted this earlier, ask questions if you need help
Sub main()
Dim myArray(30, 1) As Long
Dim myIndex As Long
Dim myRow As Long
Dim myNum As Long

myNum = 4


For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row 'change i to first
'row and "A" to first column
myArray(i, 1) = Cells(i, 1)
myRow = myRow + 1
Next


For i = 1 To UBound(myArray)
MsgBox myArray(i, 1)
If myArray(i, 1) = myNum Then MsgBox "USA"
Next

End Sub

--
--
-John
Please rate when your question is answered to help us and others know what
is helpful.

"kittycris" wrote in message
...
Thank you! How would I do this through code?

"John Bundy" wrote:

You can do a Vlookup, if the numbers that are in the us are in column A
and
the number you are testing is in G then
=IF(ISERROR(VLOOKUP(G1,A1:A31,1,FALSE)),"Other","U SA")
or did you want to do this strictly through code?
--
-John Northwest11
Please rate when your question is answered to help us and others know
what
is helpful.


"kittycris" wrote:

i have a spreadsheet where one column lists location codes. There are
20
different codes that are in the US. I want to create a formula that
says if
location code is one of these, it is equal to US. Thanks.