ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   StrComp numeric (https://www.excelbanter.com/excel-programming/397870-strcomp-numeric.html)

Rick

StrComp numeric
 
When using this VB function :
If StrComp(Target.Offset(0, -3).Text, "Debit", vbTextCompare) = 0 Then

How do I turn it into a numeric test?

Tom Ogilvy

StrComp numeric
 
If you want to compare two numbers

If target.Offset(0,-3).Value 21 then

If you mean case sensitive
replace vbTextCompare with
vbBinaryCompare

Natrually strcomp is for comparing strings.

--
Regards,
Tom Ogilvy



"Rick" wrote:

When using this VB function :
If StrComp(Target.Offset(0, -3).Text, "Debit", vbTextCompare) = 0 Then

How do I turn it into a numeric test?


Rick

StrComp numeric
 
Thanks Tom: I was thinking in the same direction, but did not realize .value
0 would work.


"Tom Ogilvy" wrote:

If you want to compare two numbers

If target.Offset(0,-3).Value 21 then

If you mean case sensitive
replace vbTextCompare with
vbBinaryCompare

Natrually strcomp is for comparing strings.

--
Regards,
Tom Ogilvy



"Rick" wrote:

When using this VB function :
If StrComp(Target.Offset(0, -3).Text, "Debit", vbTextCompare) = 0 Then

How do I turn it into a numeric test?



All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com