+ Reply to Thread
Results 1 to 4 of 4

Vlook up in VBA

  1. #1
    Registered User
    Join Date
    03-20-2014
    Location
    wolverhapton
    MS-Off Ver
    Excel 2010
    Posts
    94

    Vlook up in VBA

    Ok

    Here goes...

    So I have quite a complex userform. Basically I have a start time and an end time which gives a Time on Site in Hours,
    The user inputs and clicks a Format button "Command Button2" and its automatically calculates the time in Hours & Mins.
    Formula I am using is

    Private Sub CommandButton2_Click()
    UserForm1.txtvdt.value = Format(txtvdt.value, "hh:mm:ss AM/PM")
    mytime1 = TimeValue(UserForm1.txtvat.value)
    mytime2 = TimeValue(txtvdt.value)
    mytime3 = mytime2 - mytime1
    UserForm1.txthrs.value = Format(mytime3, "hh:mm")

    Ok So now I need this Time Different
    To look up on a another sheet the price it will cost to be on site for that period of time?
    And possibly also convert the total time to just minuets

    Example

    Time on Site "txthrs" "01:10" [1hour and 10Mins]
    Look up on sheet 3 Named "Waiting time sheet"
    and the data is in Column A, B, C
    Column A being the times in txthrs format
    Column B being the Price in £
    Column C Time converted to Min's

    So I need my text boxes
    txtmins
    txt amount
    To automatically find the values based on my txthrs Total

    Please can someone help as I know this is just a simple lookup.
    But its driving me crazy

  2. #2
    Forum Contributor pareshj's Avatar
    Join Date
    05-20-2014
    Location
    MUMBAI
    MS-Off Ver
    2007 & 2010
    Posts
    447

    Re: Vlook up in VBA

    Hi,

    Please attached sample workbook and expected output.

    Regards,
    Paresh J
    Click on "* Add Reputation" as a way to say thanks

  3. #3
    Registered User
    Join Date
    03-20-2014
    Location
    wolverhapton
    MS-Off Ver
    Excel 2010
    Posts
    94

    Re: Vlook up in VBA

    Sample Userform.xlsmSee attached Sample Workbook

    You can see the tab Waiting time Cost
    And the userform
    See Vehicle Detail Frame

    See right the 3 text boxes

    Time on Site - Automatically calculated by my previous formula
    Mins on Site - Need to look up based on Time on Site in Waiting time sheet Column C [3]
    Amount - Need to look up based on Time on Site in waiting time sheet Column B [2]

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,525

    Re: Vlook up in VBA

    sara101.
    Could you please read the forum rules. In this case #3 regarding code tags.

+ 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. [SOLVED] Do I use Vlook Up here & if so how?
    By karryan in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-29-2013, 04:14 PM
  2. [SOLVED] Vlook UP
    By joh46k in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-29-2013, 02:47 AM
  3. [SOLVED] Vlook ups help please
    By TrainerJ in forum Excel General
    Replies: 9
    Last Post: 04-26-2012, 09:35 AM
  4. #N/A with Vlook up
    By Guy Wates in forum Excel General
    Replies: 1
    Last Post: 10-14-2005, 09:02 AM
  5. [SOLVED] If with Vlook up
    By souchie40 in forum Excel General
    Replies: 3
    Last Post: 09-09-2005, 03:05 PM

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