Ankush
Ankush

Reputation: 347

How to compare specific cell values in VBA

I have this code:

If cells(3,11).value="c:users\flap-fis.txt"

This condition is getting failed every time either we have file location of or not.

How can I write the code how to check specific cell value with static string?

Upvotes: 0

Views: 78

Answers (1)

Dominique
Dominique

Reputation: 17565

Do you know how to debug VBA projects? Best thing to do for such a case is putting a breakpoint on that particular line and use the "immediate" window, where you can ask ? <var> in order to know the value of a variable, as in these examples:

? Cells(3, 11).Value = "c:users\flap-fis.txt"
False

? Cells(3, 11).Value
c:\users\flap-fis.txt
=> Mind the extra backslash, as already mentioned by PEH.

Upvotes: 1

Related Questions