Hi,
I am new to VBA and trying to automate finding marks from one sheet to another (sheet using vlookup and match. I used the below VBA code but it's not working.
Public Sub testinputbox()
'id of student that you want to search for his mark (argument 1)
Dim id2sr As Range
'evaluation row to search (argument 2)
Dim qz2sr As Range
'the sheet or table you want to search
Dim data1 As Range
'the quiz row from database
Dim qzrow As Range
Dim mark As Integer
mark = ActiveCell.Value
Set id2sr = Application.InputBox("where is id in question", , , , , , , 8)
Set qz2sr = Application.InputBox("where is evaluation row in question?", , , , , , , 8)
Set data1 = Application.InputBox("where is the database of marks?", , , , , , , 8)
Set qzrow = Application.InputBox("where is evaluation row in data base?", , , , , , , 8)
mark = Application.WorksheetFunction.VLookup(id2sr, data1, Application.WorksheetFunction.Match(qz2sr, qzrow, False), False)
End Sub
Thanks
I am new to VBA and trying to automate finding marks from one sheet to another (sheet using vlookup and match. I used the below VBA code but it's not working.
Public Sub testinputbox()
'id of student that you want to search for his mark (argument 1)
Dim id2sr As Range
'evaluation row to search (argument 2)
Dim qz2sr As Range
'the sheet or table you want to search
Dim data1 As Range
'the quiz row from database
Dim qzrow As Range
Dim mark As Integer
mark = ActiveCell.Value
Set id2sr = Application.InputBox("where is id in question", , , , , , , 8)
Set qz2sr = Application.InputBox("where is evaluation row in question?", , , , , , , 8)
Set data1 = Application.InputBox("where is the database of marks?", , , , , , , 8)
Set qzrow = Application.InputBox("where is evaluation row in data base?", , , , , , , 8)
mark = Application.WorksheetFunction.VLookup(id2sr, data1, Application.WorksheetFunction.Match(qz2sr, qzrow, False), False)
End Sub
Thanks