View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jesper Kaas Jesper Kaas is offline
external usenet poster
 
Posts: 10
Default VBA Does not recognize cell contents

On Wed, 25 Nov 2020 12:56:43 -0800 (PST), programmernovice
wrote:

I have a workbook "Optvol" having the word "put" in cell A10. In a macro:

If Workbooks("optvol.xlsx").Sheets("optvol").Range("A 10") = "put" Then

Range("c4") = "it works"

End If

C4 is in the active workbook, different from "Optvol". Nothing happens upon execution, and there is no error message

Clearly, for some reason the contents of Optvol A10 are not recognized.

Any idea what I'm doing wrong? Appreciate all help, thanks.


Maybe a stupid question, but is the file optvol.xlsx open in Excel
when you test? Pretty sure it has to be for VBA to actually do the
If-test.
--
Jesper Kaas -