+ Reply to Thread
Results 1 to 3 of 3

Problem with If- then statements and with .Value command.

  1. #1
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Problem with If- then statements and with .Value command.

    I have a textbox in a form which i named: Textbox_DownpaymentAmount which amounts to 16,000

    I have a variable called "Cell" which is located on a spreadsheet with an amount of 15,000.

    Below "Cell" ( Cell.offset(1,0) ) is an amount of 20,000.

    My code is:

    Please Login or Register  to view this content.
    It doesn't work...

    When I use F8 to debug it line by line, I hover the mouse over the variables and I noticed that Textbox_DownpaymentAmount.value has a value of "16000" (with quotations) and values stored in spreadsheet like cell.value and cell.offset(1,0).value return a value of 15000 and 20000 respectively without the quotations ("15000" and "20000"). My guess is that excel doesnt treat textbox_downpaymentamount.value as a true number because it is defined as "16000" and not just 16000. What am i doing wrong here?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,883

    Re: Problem with If- then statements and with .Value command.

    Maybe
    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    12-03-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: Problem with If- then statements and with .Value command.

    Quote Originally Posted by TMS View Post
    Maybe
    Please Login or Register  to view this content.

    Regards, TMS
    Thank you TMS it works. Question though, I want to ask when I will apply this Cdbl function? I don't want to commit the same mistake again. Do I have to do this always when I want to get the number value of a textbox in a form for computation purposes?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Multiple If Statements for a command button?
    By aduma in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-29-2012, 04:31 PM
  2. Problem with if/then statements...
    By amy3441 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2011, 05:16 PM
  3. Problem with if statements
    By smithani in forum Excel General
    Replies: 4
    Last Post: 10-15-2008, 02:52 PM
  4. [SOLVED] Problem with IF statements
    By Bob@HP in forum Excel General
    Replies: 1
    Last Post: 04-20-2006, 12:15 PM
  5. IF statements/formula problem
    By Admiral70 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM

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