+ Reply to Thread
Results 1 to 2 of 2

Moving within a specified range after User Input

  1. #1
    Registered User
    Join Date
    10-09-2008
    Location
    Texas
    Posts
    2

    Moving within a specified range after User Input

    I have a worksheet with a dynamic named range (sData) and I have an ActiveX listbox embedded on the worksheet from which specific data is chosen by the user. There is also a command button that when clicked transfers the information chosen from the list box to a specific place in the dynamic range.

    This is where I am having trouble.

    Once the information is transferred to a specific place in the range (after the command button click) I want the next input location in the dynamic range to be “active”, so that the next selection from the listbox and subsequent button click will put the information from the listbox in the correct location.

    The dynamic range is set up with locations numbered from 1 (the initial starting location in the range) to a set number determined by another defined variable (n). So I want the next active cell in the range to increment up to the nth number (oh yeah, the numbers are not in any order and are set in the range as a formula…)

    So, the first active cell in the named range (sData) is one cell to the right of “1” (the value of the cell, and the starting point for data entry). The user selects a value from the listbox, clicks the command button, and the data is transferred to the range. I then want the next active cell to be one cell right of the cell with the value “2”. Then information from the listbox can be selected, the command button clicked, and data entered into the range next to “2”…then so forth until the nth value is reached.

    This is what I have so far in regards to the “moving” of the active cell (macro assigned to the command button):

    Please Login or Register  to view this content.
    This works when the button is clicked for the first time (active cell moves to the right of “2”), but it stays at “2” no matter how many times the command button is “clicked”.

    How do I get the “counter” (i) to increment each time the command button is clicked, until it reaches n?
    Last edited by VBA Noob; 10-10-2008 at 01:56 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You don't need to Select any cells to add data to them using VBA and I suspect you could use the ListBox_Click event instead of the CommandButton. I'm not sure what you re doing your code seems to be looking for a value of 3.

    Attach the workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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. Extracting data from the same range, but user defined workbooks...
    By ColHOLM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2008, 10:56 AM
  2. Dynamic Named Range - Moving
    By jamesryan in forum Excel General
    Replies: 3
    Last Post: 05-01-2008, 08:53 AM
  3. Compare user input with range (with an if statement)
    By HBF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2008, 11:35 AM
  4. Macro to filter every tab from a user entered date range
    By penny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-13-2007, 02:35 PM
  5. Input box not collecting range object
    By cheelie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-24-2007, 08:17 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