A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Storing textin a variable and comparing to a second value



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2009, 09:12 PM posted to microsoft.public.excel.misc
Ron
external usenet poster
 
Posts: 690
Default 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  
Old May 12th, 2009, 11:01 PM posted to microsoft.public.excel.misc
FSt1
external usenet poster
 
Posts: 2,788
Default 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  
Old May 12th, 2009, 11:24 PM posted to microsoft.public.excel.misc
Ron
external usenet poster
 
Posts: 690
Default 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  
Old May 13th, 2009, 08:26 PM posted to microsoft.public.excel.misc
Ron
external usenet poster
 
Posts: 690
Default 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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:18 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.