+ Reply to Thread
Results 1 to 7 of 7

Repeatedly click a cmdButton to populate a TextBox with different cell values

  1. #1
    Registered User
    Join Date
    10-26-2013
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    6

    Repeatedly click a cmdButton to populate a TextBox with different cell values

    Hi I'm new here
    First post. Thanks for reading it.

    I'm trying to achieve the following but I'm stumped;
    Each time the user clicks the cmdButton, the value of the next cell in the column is displayed in the TextBox.
    (The user will eventually come across a value in the TextBox that he or she is looking for and select it)

    Here is my non-working novice code;

    Please Login or Register  to view this content.
    Last edited by LordBucketHead; 10-26-2013 at 03:09 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    Perhaps something like this.
    Please Login or Register  to view this content.
    PS Have you considered a combobox or listbox listing all the drivers names for the user to select from?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    Perhaps
    Please Login or Register  to view this content.
    Note that cmdButton.Tag is the row number of the current value, helping you find other data from other columns.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Registered User
    Join Date
    10-26-2013
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    Wow, thank you so much Norie. Works like a charm. I didn't know about "static". That code is an education for me and I'm very grateful to you.

  5. #5
    Registered User
    Join Date
    10-26-2013
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    Thank you mikerickson.
    I'll have to spend some time working with your code to gain a clear understanding of how it works.
    Thanks again

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    Its roughly the same as Norie's, except that it uses the .Tag property of the CommandButton instead of a static variable.

  7. #7
    Registered User
    Join Date
    10-26-2013
    Location
    Durham
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Repeatedly click a cmdButton to populate a TextBox with different cell values

    I apologise Norie, I didn't reply to one of your points. I've chosen not to use a combobox in this instance because of user limitation considerations.

+ 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. Excel VBA Help On Textbox,Cmdbutton to Move Data
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 07:35 AM
  2. [SOLVED] Copy and paste set of rows repeatedly at click of button
    By RoxanaN in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2013, 02:30 AM
  3. put the value in a textbox and populate relative values in other textboxes automatically
    By sharad.sony in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-11-2013, 03:15 AM
  4. [SOLVED] VBA Find, populate textbox, click command, findnext, display
    By ozhally in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2012, 09:39 PM
  5. [SOLVED] Click on cell, populate another in VBA
    By manwi004 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-29-2012, 09:42 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