![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Posts: 42
|
I have created a system that allows staff to enter students marks and perform various calculations.
The last part of the application requires the use of a marking matrix. This is set up as follows along the top are the following HA(High A), MA(Middle A), LA(Low A), HB, MB, LB etc these are all in row 1 Down the side are the same headings in column A So reading the grid if a student has a HA mark for on section and a LA mark for the other the matrix gives a score of 86. There are 24 x 24 marks. I have so far created the code below to select along the top and down the side (the MA in the code is just for testing but will eventually be a variable read from the students sheet) What I can't work out is how to get the column and row details from the code to put into a range.select statement. the two variable give both row and colmn I just want one from each to put into the range. Can anyone help please Dim makingmark Sub matrix() Worksheets("matrix").Select Set designingmark = ActiveSheet.Rows("1:1").Find("MA") If Not designingmark Is Nothing Then Range(designingmark.Address).Select End If Set makingmark = ActiveSheet.Columns("A:A").Find("MA") If Not makingmark Is Nothing Then Range(makingmark.Address).Select End If Andy |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
Try the following ans see if they work for you. Code:
Sub test()
Dim x, y, z
On Error GoTo ErrHandler
x = Application.Match("MA", ActiveSheet.Rows("1:1"), 0)
y = Application.Match("MA", ActiveSheet.Columns("A:A"), 0)
z = WorksheetFunction.Index(ActiveSheet.UsedRange, y, x)
MsgBox z
Exit Sub
ErrHandler:
MsgBox "Could not find a match!"
End Sub
Sub test2()
Dim x, y, z
On Error GoTo ErrHandler
x = Application.Match("MA", ActiveSheet.Rows("1:1"), 0)
y = Application.Match("MA", ActiveSheet.Columns("A:A"), 0)
Cells(y, x).Select
Exit Sub
ErrHandler:
MsgBox "Could not find a match!"
End Sub
Bye, Jay [ This Message was edited by: Jay Petrulis on 2002-05-14 09:40 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|