+ Reply to Thread
Results 1 to 10 of 10

Referencing a textbox value from a determined value to a textbox range

  1. #1
    Registered User
    Join Date
    08-22-2017
    Location
    cardiff, wales
    MS-Off Ver
    Office 2010
    Posts
    5

    Referencing a textbox value from a determined value to a textbox range

    Hi

    This is my first time posting a query, but I truly am stuck on this one.

    I am coding templated outlook emails from a userform.

    I would like to type in a value in a textbox and then when I generate the email, I want a value from a different textbox dependent on the typed in value.

    For example:
    I have two Textbox's which say: 2-5 and 5-10. Next to these are another two textboxes which say £150 and £100 respectively.

    I would like to have a 5th textbox that I can type a value in, say 3.5. This will then know that it falls in the 2-5 range and so when I generate the email it will input the textbox with £150 in to the template.

    I hope I explained it clearly enough, but I'm not sure it is possible.

    Any help would be greatly appreciated on this.

    Thanks

    Gareth

  2. #2
    Registered User
    Join Date
    07-16-2014
    Location
    Seattle, WA
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Referencing a textbox value from a determined value to a textbox range

    Are you coding the userform in outlook or excel? Can you please provide example of your current code?

  3. #3
    Registered User
    Join Date
    07-16-2014
    Location
    Seattle, WA
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Referencing a textbox value from a determined value to a textbox range

    Since I'm not sure exactly what you're looking for I used a simple if statement to get at what you want. You will have to add #0# to your e-mail template for this to work.

    Please Login or Register  to view this content.
    Last edited by kelseygueldalewis; 08-23-2017 at 08:17 AM.

  4. #4
    Registered User
    Join Date
    08-22-2017
    Location
    cardiff, wales
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: Referencing a textbox value from a determined value to a textbox range

    Apologies let me rephrase my question, as I don't think I'm doing it correctly.

    I'm coding on excel vba userform.

    As an example:
    On worksheet:-

    A1 B1 C1 D1
    0-5 £100 5-10 £150

    On my userform I have a textbox. I want to enter a value in the textbox and for that to link to a cell on the worksheet dependent on range.

    So, if I entered 3.5 then this would fall between 0-5 (A1) and so £100 (B1) will be linked.
    If I entered 7.8 then this would fall between 5-10 (C1) and so £150 (D1) will be linked.

    Is there any code I can use to activate this command on my userform?

    I tried to put code in but I'm not allowed to show html coding, which is what I have used for the email template.

  5. #5
    Registered User
    Join Date
    07-16-2014
    Location
    Seattle, WA
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Referencing a textbox value from a determined value to a textbox range

    Have you tried creating a table and using vlookup instead? It will be easier for your textbox entry to find the value that way

    0 100
    1 100
    2 100
    3 100
    4 100
    5 100
    6 150
    7 150
    8 150
    9 150
    10 150

    Then use p = VLOOKUP(t, range, 2, false)

  6. #6
    Registered User
    Join Date
    08-22-2017
    Location
    cardiff, wales
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: Referencing a textbox value from a determined value to a textbox range

    The problem with that code is it only refers to a fixed range. The range changes on different rows. So I need to reference a range typed in a cell. Not sure if it's possible.

  7. #7
    Registered User
    Join Date
    07-16-2014
    Location
    Seattle, WA
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Referencing a textbox value from a determined value to a textbox range

    Can you upload the file?

  8. #8
    Registered User
    Join Date
    08-22-2017
    Location
    cardiff, wales
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: Referencing a textbox value from a determined value to a textbox range

    The prices also change from row to row.

    so it may be like:
    A B C D E F
    0-5 £100 5-10 £150
    2-5 £75 5-8 £100
    0-5 £50 5-10 £100 10-15 £150

  9. #9
    Registered User
    Join Date
    07-16-2014
    Location
    Seattle, WA
    MS-Off Ver
    Office 365
    Posts
    67

    Re: Referencing a textbox value from a determined value to a textbox range

    What is the identifier for the row you will use as your price reference?

  10. #10
    Registered User
    Join Date
    08-22-2017
    Location
    cardiff, wales
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: Referencing a textbox value from a determined value to a textbox range

    Hopefully attachment is in this thread.

    The cells on 'details' worksheet are the rebar weight and rebar cost columns, that I need to reference and link. Needs to go into light load email template.

    I basically want to type a tonnage in the yellow tonnage box, and for that to reference one of the three rebar boxes depending what range it falls in to.
    Attached Files Attached Files
    Last edited by gwelf; 08-23-2017 at 08:40 AM.

+ 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] Highlight textbox if date <=60 days referencing an array as textbox numbers
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-23-2017, 11:43 AM
  2. [SOLVED] Excel 2010 - Userform - display date from textbox in a label or textbox in 'ddd' format
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2015, 10:54 PM
  3. Excel 2010 – VBA Userforms – Vlookup via Textbox, display result in another textbox
    By theshybutterfly in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-29-2015, 12:31 AM
  4. [SOLVED] Type in TextBox after referencing a different Textbox
    By WAYNE005 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-05-2014, 06:50 PM
  5. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  6. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 PM

Tags for this Thread

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