Help needed with userform label and Index/Match.

mrscottjr

New Member
Joined
Jul 24, 2015
Messages
41
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi all,
I'm looking for some help with getting userform label's caption to be the result of an index/match formula.

Here's the setup:
Two sheets, each with a table.
Sheet1 has Table1, Sheet2 has Table2.
Both tables are generally set up the same as far as column titles go.
The userform is opened by double-clicking a student's name in the Table1[Student Name] column (Column "A").
On my userform I have two columns of labels set up. The first column represents a student's current grade (LblCurrGrade) from Table1[Student Grade], the second column needs the student's previous grade (LblPrevGrade) from Table2[Student Grade].

Given that the userform is called by double clicking on the a name in Table1[Student Name], the label of LblCurrGrade is simple enough by writing the code as:
Code:
LblCurrGrade.Caption = Cells(ActiveCell.Row, "A").Value

I'm struggling on how to write the code to pull in that student's previous grade as scene on Sheet2/Table2. I'm assuming there could be a way to use Index/Match to grab this grade based on matching the Student Names from each table, but not sure if that's correct or how to write it to avoid errors.

Also, if there's a way to refer to the table field rather than "Cells(ActiveCell.Row, "A").Value", it would be ideal given that some users may alter the column placements in the tables.

Any suggestions?
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Should be straightforward, what are the column headings in the second table?

For the second part can't you just use ActiveCell on its own to get the student name?
 
Upvote 0
Thanks for the reply. The column headings on the second table are the same as on the first table. So in this example both tables contain [Student Name] and [Grade].

I'm not certain what you mean in the second line of your response.
 
Upvote 0
Any thoughts gang? I've been plugging away at this today but with no success. It feels like it should be an easy solution but it's just not clicking in my head...
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top