'Looping through an array and writing back to the sheet based on the item of the array, using the match function
Ok, so basically I have an array that stores the information of the requested modules of students and there is a separate sheet that has these modules in the columns and the rows have the students' ID, I have a variable called studentID and I need help to loop through the array and then find the row of the student by matching their student ID with my variable and then put an "X" in the correct column of the chosen module.
Set Requests = ThisWorkbook.Worksheets("Requests")
StudentID = Requests.Cells(RowNum, 1).Value
dim rowCurrentstudent as Variant
Set PartC= thisWorkbook.Worksheets("PartC")
For Each Module In RequestedModules
'basically we need to find the row of the studnetid we are looking at and then find the module we are looking at and put and X in that cell
rowCurrentstudent = PartC.Match(StudentID, "A:A", 0)
Cells(PartC.Range("A:A").Find(Module).Row) = "X" 'not sure about this
Next Module
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|