Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Storing textin a variable and comparing to a second value
Not sure if I'm going about this right.
I need to go compare text (a name) in a cell with text (a name) in another cell. After that I do some stuff, which I should be able to handle. I just can't figure the VBA syntax to do that. It will be part of a larger macro. New to VBA and can't seem to find a web site that helps. Ron |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Storing textin a variable and comparing to a second value
hi
a little sketchy on details but try this.. Sub Matchit() If Range("A2").Value = Range("C2").Value Then MsgBox "match" Else MsgBox "no match" End If End Sub regards FSt1 "Ron" wrote: Not sure if I'm going about this right. I need to go compare text (a name) in a cell with text (a name) in another cell. After that I do some stuff, which I should be able to handle. I just can't figure the VBA syntax to do that. It will be part of a larger macro. New to VBA and can't seem to find a web site that helps. Ron |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Storing textin a variable and comparing to a second value
Thanks very much. It was the
If Range("A2").Value = Range("C2").Value Then syntax I couldn't figure out. Ron "FSt1" wrote: hi a little sketchy on details but try this.. Sub Matchit() If Range("A2").Value = Range("C2").Value Then MsgBox "match" Else MsgBox "no match" End If End Sub regards FSt1 "Ron" wrote: Not sure if I'm going about this right. I need to go compare text (a name) in a cell with text (a name) in another cell. After that I do some stuff, which I should be able to handle. I just can't figure the VBA syntax to do that. It will be part of a larger macro. New to VBA and can't seem to find a web site that helps. Ron |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Storing textin a variable and comparing to a second value
Ok, ok, I'm stuck again. The test worked, but after the test, I need to
increment both A2 and C2 by 8 and run it again. (a10 & c10) I can't figure out how to store it and then increment it. If I use relatives and offset, how do I compare the two cells again? Sub Matchit() If Range("A2").Value = Range("C2").Value Then Increment a2 to a10 and c2 to c10 and run it again. Else Insert 8 blank lines, moving c2 down to c10 and test again. (I think I can do this as I did it in a macro) End If End Sub Thanks for the help. Ron "Ron" wrote: Thanks very much. It was the If Range("A2").Value = Range("C2").Value Then syntax I couldn't figure out. Ron "FSt1" wrote: hi a little sketchy on details but try this.. Sub Matchit() If Range("A2").Value = Range("C2").Value Then MsgBox "match" Else MsgBox "no match" End If End Sub regards FSt1 "Ron" wrote: Not sure if I'm going about this right. I need to go compare text (a name) in a cell with text (a name) in another cell. After that I do some stuff, which I should be able to handle. I just can't figure the VBA syntax to do that. It will be part of a larger macro. New to VBA and can't seem to find a web site that helps. Ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Storing a range variable in a cell | Excel Discussion (Misc queries) | |||
Storing a value to variable | Excel Discussion (Misc queries) | |||
storing data | Excel Worksheet Functions | |||
Storing Formulas to Use | Excel Worksheet Functions | |||
Storing Values | Excel Discussion (Misc queries) |