Hi, I need know if the caption of a checkbox is within the name of a sheet.
I tried this, but it's not working, because "Else" aways happens, to all sheets(k), even in not having the text of the checkbox in the name of the sheet.
What could I do?Code:If CheckBox2 = True Then j=0 For k = 1 To Sheets.Count If InStr(1, Sheets(k).Name, checkbox2.caption, 1) = 0 And InStr(1, Sheets(k).Name, checkbox1.text, 1) = Null Then Else Sheets_I_Need(j) = k j = j + 1 End If Next k End If




Reply With Quote
