+ Reply to Thread
Results 1 to 2 of 2

Writing data to specific cell in a table

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    bergen county, NJ
    MS-Off Ver
    Excel 2007
    Posts
    72

    Writing data to specific cell in a table

    I attached a small jpg of a grid...
    I figured out how to use the ADDRESS function coupled with MATCH to have the cell address returned to me... I can answer the question, what is the address of the cell whose intersection is feb & red. (using the "=" in another cell on the sheet, not in a userform)

    what i want to do is create a userform in which the user will use 2 different combo boxes to select which month and which color, and then the OK comman will write the textbox data to the appropriate cell

    any help is much appreciated !

    thanks!
    -rob
    Attached Images Attached Images

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Writing data to specific cell in a table

    Your method for finding the address of a cell is fine for formulas with an Excel worksheet. But let's take advantage of VBA features to simplify this.

    When you select an item from a combobox, you can refer to the ListIndex property, rather than taking the value of the combobox and looking it up in another list.

    ListIndex is 0 for the 1st element so you have to add 1.

    For your grid, let's assume the data (not the headings, just the numbers) is in the range B2:E4. Let's say combobox1 has the color, combobox2 has the month. Also, ListIndex is -1 if the user hasn't selected anything.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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