+ Reply to Thread
Results 1 to 4 of 4

increment one row at a time with cmd button

  1. #1
    Registered User
    Join Date
    07-13-2012
    Location
    Stoke UK
    MS-Off Ver
    Excel 2003
    Posts
    15

    increment one row at a time with cmd button

    Have a simple sheet of 4 columns, a form with 4 txt boxes, 1 button & 1 Lble
    on loading the form the 3 righthand columns are entered into their txtboxes
    user enters corresponding txt to match column 1

    I need the form to select the next row on button click
    Ideally I would like to select all 90 rows randomly without repeats but would be happy just to progress in sequence for now.

    excel.JPG


    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: increment one row at a time with cmd button

    Maybe:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-13-2012
    Location
    Stoke UK
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: increment one row at a time with cmd button

    Thanks JBeaucaire, nice code but unfortunately no joy.

    I don't know anything about the xlLookin, xlLookat methods, used to use VB6 some years ago
    and know I've done something like this before but don't have VB6 on my pc to check.

    I have a problem as to where to put an incrimenting loop, if you put it in the Enter cmdbutton it will reset everytime you click. I think you have to create a module and place the loop
    ie: for x = 1 to 90 or x = x + 1 etc in the module but really can't remember how to set it up.

    I'm using Excel 2003 and I'm not sure about using variables in cell selection as

    TxtCode.Value = Worksheets("Test").Range("C" & NumFND.Row).Value

    I've tried to use a variable x and .Range("C" & x).Value also but either way does not seem to find any values which makes me question the syntax of that method for my version of Excel? or maybe its just not the correct way at all.

    Thanks

  4. #4
    Registered User
    Join Date
    07-13-2012
    Location
    Stoke UK
    MS-Off Ver
    Excel 2003
    Posts
    15

    Re: increment one row at a time with cmd button

    I remembered after some trial and error,

    dim x as integer "in general section"

    create sub increment() and include x = x + 1
    then call increment from within cmdclick()

    now need to check columns j + k for next empty cells to export date and result to keep a record of results

+ 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