+ Reply to Thread
Results 1 to 7 of 7

Use input box variable as entry for text in a cell

  1. #1
    Registered User
    Join Date
    01-07-2010
    Location
    Dorothy and Todo Land, KS
    MS-Off Ver
    Office 2003 & 2007
    Posts
    34

    Use input box variable as entry for text in a cell

    Hi all,

    I am wanting to use the answer a user provides from an input box and place it in a specific place within a cell's text. For example:

    Please Login or Register  to view this content.

    Obviously the above code doesn't work, but I'm not able to find any information to take the information the user provides in the answer and refer to it within code. I can use "date1", but the information the user types in for "date1" does not display in cell c6. It just says: "The plan is effective on date 1."

    Any help is appreciated. Thank you.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Use input box variable as entry for text in a cell

    Please Login or Register  to view this content.
    Last edited by Palmetto; 02-19-2010 at 10:33 PM. Reason: revised code
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    01-07-2010
    Location
    Dorothy and Todo Land, KS
    MS-Off Ver
    Office 2003 & 2007
    Posts
    34

    Re: Use input box variable as entry for text in a cell

    Thank you for the code. I think I'm getting closer. Let me give you the actual code of what I'm using so you see what I'm doing.

    Please Login or Register  to view this content.

    I'm not sure what I have wrong here.
    Last edited by HOT97ECLIPSEGSX; 02-19-2010 at 09:41 PM.

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Use input box variable as entry for text in a cell

    Study the code I gave and adapt it.

    You don't need to dimension "a" as a range when it can be referred to directly as Range("C6"). It doesn't help your code.

    There is a difference between "Inputbox" and Application.Inputbox. The latter allows more control over the input to force specific types of data entry.

    You don't need to select or activate cells in VBA to act on them.

    I don't know why you are using "Unload Me" while using a command button and calling an input box. Is this part of a user form?

    Note: I amended the code to force the user to input a valid date by changing the variable from Variant to Date and using the IsDate function.

  5. #5
    Registered User
    Join Date
    01-07-2010
    Location
    Dorothy and Todo Land, KS
    MS-Off Ver
    Office 2003 & 2007
    Posts
    34

    Re: Use input box variable as entry for text in a cell

    I'm not an expert at VBA. I'm using the book "Master Visually Excel 2003 VBA Programming" book by Julia Kelly to help me.

    Yes, this is part of a userform. A user clicks a button for "Plan Change" and it pops up a window with a bunch of plans. The user selects the right plan and then the question is asked. After the question is answered the userform shuts down and the information about the plan is placed in the text along with the answer the user provides.

    EDIT: Also, when a person clicks a button, it places text in a cell. If the user clicks another button, it doesn't replace the text, it "stacks" from within the cell. So it will do Range(C6) = a & "information". Instead of just setting the cell's value as one thing.
    Last edited by HOT97ECLIPSEGSX; 02-19-2010 at 11:09 PM.

  6. #6
    Registered User
    Join Date
    01-07-2010
    Location
    Dorothy and Todo Land, KS
    MS-Off Ver
    Office 2003 & 2007
    Posts
    34

    Re: Use input box variable as entry for text in a cell

    I don't think you see why I have the select cells that I do. I'm making a noting tool for a call center I work in. When I clear the fields, I select the top field, C3, so we're starting on the beginning and not leaving the cleared fields highlighted in blue. This makes the tool look cleaner.

    If I just wanted the format of "resp" just to be open text, how would I format it?
    Last edited by HOT97ECLIPSEGSX; 02-19-2010 at 11:23 PM.

  7. #7
    Registered User
    Join Date
    01-07-2010
    Location
    Dorothy and Todo Land, KS
    MS-Off Ver
    Office 2003 & 2007
    Posts
    34

    Re: Use input box variable as entry for text in a cell

    OK, I'm uploading the tool I'm working with so you guys can see what I'm doing in action.

    The button I'm working on right now is "Change Plan". Clicking this button pops up the window, or the user form. The only one I've programmed with the above is Everything Data 3000, which is the top left button in the pop up. It asks the question, and the program takes the answer and places it exactly where I want it in the actions taken field (which is C6:C7).

    What I'd really like to do is make the answer not be required to be in "mm/dd/yy" format, but rather an open text field. I don't want the user to go "WTF do I do" while using the tool.
    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