ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format statement no longer throws an error (https://www.excelbanter.com/excel-programming/292884-format-statement-no-longer-throws-error.html)

PF[_2_]

Format statement no longer throws an error
 
I had code running in Excel 97 that would throw an error, but now that I am running Excel 2003 it does not.

Format$("0.5","General"

It used to throw error 5 (Invalid procedure call or argument), but now it returns "Ge5eral". Is this a documented change?

Rob van Gelder[_4_]

Format statement no longer throws an error
 
You're mixing Worksheet NumberFormat expression with VBA format.

It's interpretting the N in "General" as a minute (hh:nn:ss)

If you want to format a cell as General:
ActiveCell.NumberFormat = "General"


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"PF" wrote in message
...
I had code running in Excel 97 that would throw an error, but now that I

am running Excel 2003 it does not.

Format$("0.5","General")

It used to throw error 5 (Invalid procedure call or argument), but now it

returns "Ge5eral". Is this a documented change?



Dave Peterson[_3_]

Format statement no longer throws an error
 
Try:

Format$(0.5, "General Number")

(not sure why you had "0.5" in double quotes, either.)

PF wrote:

I had code running in Excel 97 that would throw an error, but now that I am running Excel 2003 it does not.

Format$("0.5","General")

It used to throw error 5 (Invalid procedure call or argument), but now it returns "Ge5eral". Is this a documented change?


--

Dave Peterson


Wei-Dong Xu [MSFT]

Format statement no longer throws an error
 
Hi,

Thanks for posting in the community!

I agree with Rob and Dave. If you have any other questoins, please feel free to let me know.

Enjoy a nice weekend!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



PF[_3_]

Format statement no longer throws an error
 
That's all interesting information, but it didn't really
answer my question, which is why does this statement not
throw an error while it did in previous versions.
-----Original Message-----
Hi,

Thanks for posting in the community!

I agree with Rob and Dave. If you have any other

questoins, please feel free to let me know.

Enjoy a nice weekend!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and

confers no rights.


.


Wei-Dong Xu [MSFT]

Format statement no longer throws an error
 
Hi PF,

Thank you for replying!

Currentlly we are performing some research on this problem, and we will reply you ASAP if we get any results!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.



Jim Vita

Format statement no longer throws an error
 

Hi,

It sure looks like the string "General" is being interpreted as a format
string and that your value is being inserted at the "n" position. I will
have to investigate if the behavior Format in Excel 2003 has changed. I'll
post another reply as soon as I have finished investigating.

Thanks for your patience.

Thanks,

Jim

Jim Vita
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.



All times are GMT +1. The time now is 01:05 AM.

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