VBA - MS VB Compile Error

  • Thread starter Thread starter jordanctc
  • Start date Start date
J

jordanctc

Tom,

***I got it to do it again - This worked

Sub Trial1()
Range("A1").Value = Format(Now(), "m-dd-yyyy")
End Sub

***Then I added a macro named Format - this gave me the compile erro
when trying to run Trial1

Sub Trial1()
Range("A1").Value = Format(Now(), "m-dd-yyyy")
End Sub

Sub Format()
MsgBox "Now I'm messing with you"
End Sub

***Then I renamed Format to Format1 - this ran fine

Sub Trial1()
Range("A1").Value = Format(Now(), "m-dd-yyyy")
End Sub


Sub Format1()
MsgBox "Now I'm messing with you"
End Sub

And I might not have been clear but all computers were getting th
error today until I changed the macro name. Another behavior I notice
was when there was a macro named Format, when typing in "format(" th
property popup did not show.

Jorda
 
I don't question that that is the cause. It absolutely is. I was saying in
your original post you said
The following code was working on Friday but today on several computers
the VBA code has a big problem with the format function.

To me that comes across as "some" and not "all". In fact my purpose in
posting was to reinforce the fact that that is the problem. And perhaps a
little bit quizzical that it wasn't all computers - but you now confirm that
it was all computers - which is consistent with expectations.
 
DO NOT USE RESERVED WORDS AS PROCEDURE OR VARIABLE NAMES!!! ('shouting'
intended <g>)
 

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

Back
Top