Hi everyone,
I have been getting the same error when attempting this course assignment as mentioned in the thread title above. The assignment objective is to create a subroutine that allows the user to select the Identifier from a drop-down menu in cell F2 and the Key from a drop-down menu in cell F3 (these drop-down/data validation menus are already available in the starter file) and any rows of the data (columns A, B, and C) whose Batch ID meets those criteria will be highlighted GREEN.
I've attached a screenshot of the Excel file for reference:
Screenshot 2024-02-20 200654.png
My own written code so far are as below;
Screenshot 2024-02-20 201256.png
with Identifier & Key already provided in the code as below:
Screenshot 2024-02-20 201426.png
From what I understand, the code I've written should be able to highlight the Batch ID following the Identifier at the first letter and the Key at the number after the hyphen (e.g. "T3-238L" - Identifier: T, Key: 2), but I keep getting the compile error: Expected Array when running the code.
So far, I've tried doing several things to troubleshoot my code:
- removing 'identifier As String' from the Dim line of the code, but it still came up with the same error
- Replacing 'identifier(ID)' and 'key(ID)' by just 'ID'; but that just skips the For... Next loop completely.
- I've tried using 'Range("A2:A")" for the If statement line, but still the same error (I know that this might be wrong in the first place, but it was worth a shot)
I'm new to Excel/VBA programming and to this forum as well, and also would like to ask for help in identifying what what missing from my code. I'll really appreciate any help from everyone on this forum. Thanks!
Bookmarks