+ Reply to Thread
Results 1 to 3 of 3

Index Match into code when name is selected from combo box.

  1. #1
    Registered User
    Join Date
    07-06-2011
    Location
    salem, or
    MS-Off Ver
    Excel 2010
    Posts
    11

    Index Match into code when name is selected from combo box.

    I am currently using the below formula to index and match.

    =INDEX(Individualnames!$D$3:$D$24991,MATCH(Collectionsheet!D45,Individualnames!$E$3:$E$24991,0))

    I would like to put this into code where it will populate a text box (gradyear) when a name is selected from a combo box (studentname).

    Thanks for any help.

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Index Match into code when name is selected from combo box.

    Okay, this one has been quiet for a while.
    Are you asking how to include an Excel function within VBA? If so, this link may help (as well as the many that appear for 'excel formulas in vba'):
    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

    Essentially, use Application.Worksheetfunction.your_formula_here

    Or, are you asking for the entire solution? If so, while your request is possible, it has a caveat and I would advise other solutions. Essentially, there is no easy way to change the text in a text box. And by text box, I assume you mean a true text box from the Insert->Text Box ribbon, and not a cell with text in it. As you have determined VBA is needed. One of the concerns is that it would need to be a macro that resides in the Worksheet_update event handler. That means the macro will run every time a cell is updated. Usually not a big deal, but it may be overkill.

    Also, is your combo-box an activex or a form control? If so, then you should be able to add the code within the control's event handling routine. Not sure of your coding experience, so not sure where you are stuck.

    Would in not be possible to just create a cell which looks like a text box? Then the cell would contain your formula and you are done.
    Or, if there is some shape or look of the text box that cell formatting can achieve, can you have the text box be semi-transparent or use 'no fill' and then place the shape over a cell that has your function in it?
    Or, if you want it to be movable, could you use a picture of a cell in another location that holds your text?
    Last edited by Pauleyb; 10-28-2013 at 03:44 PM.
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    07-06-2011
    Location
    salem, or
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Index Match into code when name is selected from combo box.

    Thank you for your reply. The problem was solved. I pasted the code below. I created userform with text boxs and combo boxes. I was able to do most of the coding but got really stumped on this one.



    Dim emptyRow As Long
    Dim xlCalc As XlCalculation
    On Error GoTo ExitPoint
    With Application
    xlCalc = .Calculation
    .Calculation = xlCalculationManual
    .EnableEvents = False
    .ScreenUpdating = False
    End With

    'Make Sheet1 Active

    Sheets(1).Activate

    'Determine emptyRow
    emptyRow = WorksheetFunction.CountA(Range("d:d")) + 2


    'Export Data to worksheet
    Cells(emptyRow, 1).Value = Datebox.Value
    Cells(emptyRow, 3).Value = LFETextBox.Value
    Cells(emptyRow, 2).Value = BoxTopTextBox.Value
    Cells(emptyRow, 4).Value = Studentname.Value
    Cells(emptyRow, "E").Value = Class.Value





    'Empty Studentname
    Studentname.Value = ""

    'Empty BoxTopTextbox
    BoxTopTextBox.Value = ""

    'Empty PhoneTextBox
    LFETextBox.Value = ""
    Class.Value = ""
    ExitPoint:
    With Application
    .Calculation = xlCalc
    .EnableEvents = True
    .ScreenUpdating = True
    End With

    End Sub

+ 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. Return a value with which combo of Lookup/Match/Index?
    By erickguz in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-20-2013, 04:27 AM
  2. Three Way Lookup Using Index Match Combo
    By nathanhamilton82 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-07-2012, 03:39 PM
  3. VBA index match to to fill textbox form combo?
    By fcb1900 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-14-2010, 03:22 PM
  4. Lookup, Index, Match ... Not sure which combo will do it?
    By nikko4239 in forum Excel General
    Replies: 4
    Last Post: 06-08-2010, 06:32 PM
  5. Using combo box with match required and no data selected
    By Khaos176 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-19-2009, 11:20 AM

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