My code is of courses that students take. Depending on which course they take, a variable gets incremented. I then need to check if this variable is a certain number. When the first row evaluates the variable is equal to 1 and it’s executing the following code because it’s somehow meeting the last condition? I need to figure out what I am messing up with my conditional “AND” statements.
Here is the chunk of code (not the complete code):
'Check for completer status
ElseIf acc_comp >= 21 And acc_comp <= 25 Or _
pl_an_sys_comp = 50 Or _
pl_an_sys_comp = 60 Or _
auto_tech_comp >= 21 And auto_tech_comp <= 23 Or _
cul_art_comp >= 21 And cul_art_comp <= 25 Or _
dig_art_des_comp >= 21 And dig_art_des_comp <= 23 Or _
ece_comp >= 31 And ece_comp <= 37 Or _
envi_nat_res_comp = 40 Or _
envi_nat_res_comp = 50 Or _
gen_manag_comp >= 21 And gen_manag_comp <= 26 Or _
graph_comm_comp >= 21 Or graph_comm_comp <= 23 Or _
health_sci_comp >= 21 Or health_sci_comp <= 28 Or _
horti_comp = 40 Or _
horti_comp = 50 Or _
mark_manag_comp >= 21 And mark_manag_comp <= 24 Or _
mark_manag_comp = 30 Or _
media_tech_comp >= 21 And media_tech_comp <= 23 Or _
pltw_biomed_sci_comp >= 21 And pltw_biomed_sci_comp <= 26 Or _
pltw_pre_eng_comp >= 22 And pltw_pre_eng_comp <= 26 Or _
sports_med_comp >= 21 And sports_med_comp <= 27 Or _
fam_con_sci_comp >= 21 And fam_con_sci_comp <= 26 Or _
fam_con_sci_comp = 30 Or _
prog_soft_dev_comp >= 21 And prog_soft_dev_comp <= 25 Then
pc.Activate
term_match = Application.Match(main.Cells(i, 14), pc.Range(Cells(4, 77), Cells(30, 77)), 0)
If IsError(term_match) Then
ElseIf term_match > 0 Then
If IsEmpty(pso.Cells(DestRow, 3)) Then
pso.Cells(DestRow, 1) = main.Cells(i, 1)
pso.Cells(DestRow, 3) = "Y"
I will also include a picture to show the count of prog_soft_dev_comp as I go through it.
I understand that prog_soft_dev_comp is <= 25, but I was hoping that the value of 1 would not evaluate in that last line, but it seems like it is? Am I writing this incorrectly? I looked at
conditional statement AND formatting
to check and see if my formatting needed to change.
I’m sure it’s simple and looking forward to thoughts.
Thank you in advance.