ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cells formatting done without me allowing it in VBA (https://www.excelbanter.com/excel-programming/334283-cells-formatting-done-without-me-allowing-vba.html)

Werner[_29_]

Cells formatting done without me allowing it in VBA
 

Hi,
I have 2 sheets that are used as source data. And I have a form where I
import from the source sheets data. After modifications, I copy back the
data in the source sheets. The problem is that cells formatted as
monetary values with decimal seem to copy as text. So when I try to do
automated mathematic functions in vba, it says incompatible type. And
when I debug in VBA, I see that the monetary values have quotation
marks in the yellow debug mode as if it was quoted as text. Is there a
way to prevent this side effect?
Thx!

Werner


--
Werner
------------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=386446


Tom Ogilvy

Cells formatting done without me allowing it in VBA
 
Convert them to numbers.

Anything stored in a textbox is a string.

--
Regards,
Tom Ogilvy

"Werner" wrote in
message ...

Hi,
I have 2 sheets that are used as source data. And I have a form where I
import from the source sheets data. After modifications, I copy back the
data in the source sheets. The problem is that cells formatted as
monetary values with decimal seem to copy as text. So when I try to do
automated mathematic functions in vba, it says incompatible type. And
when I debug in VBA, I see that the monetary values have quotation
marks in the yellow debug mode as if it was quoted as text. Is there a
way to prevent this side effect?
Thx!

Werner


--
Werner
------------------------------------------------------------------------
Werner's Profile:

http://www.excelforum.com/member.php...o&userid=24304
View this thread: http://www.excelforum.com/showthread...hreadid=386446




Werner[_30_]

Cells formatting done without me allowing it in VBA
 

Thx for the help Tom. Finally I have found a way to solve my problem
Before importing data from the source sheet I run a macro that format
all currency values into standard values. They, by this way, becom
regular numbers. It then copies those values into my form and they ar
reconverted as currency values after that. And my math functions wor
after that

--
Werne
-----------------------------------------------------------------------
Werner's Profile: http://www.excelforum.com/member.php...fo&userid=2430
View this thread: http://www.excelforum.com/showthread.php?threadid=38644



All times are GMT +1. The time now is 11:24 AM.

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