+ Reply to Thread
Results 1 to 10 of 10

Is there an easier way to do this if_else_then statement

  1. #1
    Registered User
    Join Date
    01-15-2008
    Posts
    19

    Is there an easier way to do this if_else_then statement

    Hi,

    Is there an easier way to do this if_else_then statement


    befoe i add in the code, what tags do i need to put on the code?

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon kinder

    Just click on the "#" button in the toolbar just above your thread main window - only visible when you're composing a post.

    Or add this tag at the start :
    {CODE}
    and this tag at the end
    {/CODE}
    (but replace {} with [])

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Paste your code into the answer window, select it and click # in the Toolbar above.

    If you haven't got this Toolbar displayed then type [code] before your code snippet and at the end type [ /code] - note no spaces.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    01-15-2008
    Posts
    19
    Please Login or Register  to view this content.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What about

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-15-2008
    Posts
    19
    Thanks.

    I have gathererd if i want a career in Excel/vba i guess it's easier to figure it out myself.

    Thanks anyway, i will try your code later and read up on how it works.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It's simple. You seem to have a maximum of 50 hours, so you set chk as 50 then if chk is greater than hour is greater than 50, you deduct chk from hour which leaves the number of hours over 50 which leaves 50. This would work as well. Defining chk as a Const just makes management of the code easier, you only ned to change the value of the constant.

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-15-2008
    Posts
    19
    I have a deadline to do this and my code is working, i know it's rubbish for the long run but my manager don't know that.

    I will use your code and change it next week, thanks

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Check your code, it has some duplicates in.

  10. #10
    Registered User
    Join Date
    01-15-2008
    Posts
    19

    Thumbs up

    Well spotted

+ 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