Posted on 2011-03-25
I need some guidance on how to get my VBA code to select the correct sheet. I am not sure if it should be a "case select" or "If statement". I have tried a few things, but the wrong sheet is being selected.
I have 5 sheets in the workbook and they all validate Range"I4"
I need it to determine which sheet to select based on the value of thiscell.
If sheet5.Range("I4").value = 0 then
Elseif sheet4.Range("I4").value = 0 then
Elseif sheet3.Range("I4").value = 0 then
Elseif sheet2.Range("I4").value = 0 then
I am not sure what I am doing wrong - but the code is not activating the correct sheet. I always want it to eliminate sheet5, then sheet4, then sheet3, then sheet 2 and finally go to sheet1 if all the others are eliminated - in that sequence. Do I need to resort the Else statements or is this a Case issue?