+ Reply to Thread
Results 1 to 3 of 3

Cells formatting done without me allowing it in VBA

  1. #1
    Registered User
    Join Date
    06-14-2005
    Posts
    41

    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

  2. #2
    Tom Ogilvy
    Guest

    Re: 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" <Werner.1s2ayo_1121181453.4956@excelforum-nospam.com> wrote in
    message news:Werner.1s2ayo_1121181453.4956@excelforum-nospam.com...
    >
    > 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
    >




  3. #3
    Registered User
    Join Date
    06-14-2005
    Posts
    41
    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 formats all currency values into standard values. They, by this way, become regular numbers. It then copies those values into my form and they are reconverted as currency values after that. And my math functions work after that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1