+ Reply to Thread
Results 1 to 5 of 5

Trouble with less than greater than vba code

  1. #1
    Registered User
    Join Date
    05-22-2009
    Location
    Shirland, IL
    MS-Off Ver
    Excel '00 & '03
    Posts
    51

    Trouble with less than greater than vba code

    Hey all,

    I'm having some trouble with the following code:

    Please Login or Register  to view this content.
    the user should be able to enter any value into the specified textbox and if the value is less than or equal to 12 it is multiplied by a value on another form. if its greater, than by a different value on that same form.

    This code works fine for numbers up to and equal to 12, but if you put say 13 in the text box, the MLE becomes 0 and i don't know why. any help would be great. Thanks

  2. #2
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Trouble with less than greater than vba code

    It is difficult to say without knowing what values your other variables have...

    What value does MLE have on entering this piece of code?
    What value is in UserForm9_2.TextBox2.Value?
    Similarly for Me.TextBox1.Value, UserForm9_4.TextBox3.Value.
    What datatype is MLE defined as ?

    The one thing we do know is that Me.Controls("Textbox" & i * 100 + 1).Value should be >12 for the 'Else' statement to be running, which is when you say your problem is.

    You have provided a very small code snippet, that is full of variables, and not provided any example values for them that cause the problem you are describing.
    Help us to help you
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  3. #3
    Registered User
    Join Date
    05-22-2009
    Location
    Shirland, IL
    MS-Off Ver
    Excel '00 & '03
    Posts
    51

    Re: Trouble with less than greater than vba code

    ok So here is the whole code (The part i'm working on is 'mill labor rate then 'Saturday Rate

    Please Login or Register  to view this content.

    Thats a lot of code sorry. But ok i did fix the bit of cod ethat said userform9_2 to userform9_4 and I get a value now, but its almost twice what it should be.

    Here are some following values it is pulling in:
    userform9_4.textbox1.value = 160
    userform9_4.textbox2.value = 245
    userform9_4.textbox3.value = 265
    userform9_4.textbox4.value = 885
    userform9_4.textbox5.value = 100
    userform9_4.textbox6.value = 100
    me.controls("Textbox" & i *100 +1).value = A value between 0 and 24

    Note: I'm still working on a lot of the code to make this all work, and i'm doing it by section, so i'm only 100% sure about the sections up till the saturday section.

    Thanks for all your help

  4. #4
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Trouble with less than greater than vba code

    I think an example workbook is going to need to be uploaded actually.
    where is that command button located? Without knowing that I don't think 'we' can tell what Me refers to...

  5. #5
    Registered User
    Join Date
    05-22-2009
    Location
    Shirland, IL
    MS-Off Ver
    Excel '00 & '03
    Posts
    51

    Re: Trouble with less than greater than vba code

    Ok so i hope you can understand my mess....

    all you have to do is hit the button on sheet1

    next you select the dates you want (click and drag)

    after you hit continue double click on "Regional Service Manager"

    after that there will be a "Calender" showing your selected dates. Enter (in the top left corner) the number of people (1 for now and only in days) and hit update.

    the rates should work like so:
    Travel = 100 Per hour
    Base rate (10 hours or less) = 160
    Overtime (every hour over 10 and up to 12 {2hrs max}) and saturday rate = 245 per hour
    Dbl overtime (every hour over 12 hrs) and sundays= 265
    Stand-by days= 885
    in-house hour rate = 100

    hope this helps
    Attached Files Attached Files

+ 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