what does "Compile Error : Invalid Qualifier" mean?

F

funkymonkUK

I keep getting the above message everytime I try run a piece code.

the code I am running is the following:

Dim cell As Object
Dim strPath As String
Dim strMonth As String
Dim strYear As String

strPath = Sheets("admin").Range("b4").Value & "\01. Data\"

For Each cell In Range("periodtosearch")

strMonth = Left(cell, Len(cell) - 5)
strYear = Right(cell, 4)
Sheets("admin").Range("b10").Value = strMonth
If strMonth.Value = "January" Or strMonth.Value = "February" Or _
strMonth = "March" Then strYear.Value = strYear.Value + 1


it breaks on the if statement and highlights the strMonth the word? An
ideas
 
P

papou

Hello
The Value property is not available with a string variable.
So you should simply amend your code with
If strMonth = "January" Or strMonth = "February" Or _
strMonth = "March"

HTH
Cordially
Pascal

"funkymonkUK" <[email protected]> a
écrit dans le message de (e-mail address removed)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top