add warning message box if sheet is not exist

  • hello

    i need help about add message if the sheet isn't existed the code asks me when i add the data which sheet sometimes i make mistake the name should warn me is wrong not existed this sheet i try add this line but the code doesn't work very well it

    If whichsheet <> Worksheet Then MsgBox "this sheet is not  available"
    Exit Sub

    orginal code

  • How about

    If Not Evaluate("isref('" & whichsheet & "'!A1)") Then
       MsgBox "Sheet " & whichsheet & " does not exist"
       Exit Sub
    End If
  • Why have three identical sheets for data entry. No wonder you are starting to have issues- all related data should be stored on one sheet. If you have multiple sheets then prevent having to check by making the user select a sheet first!

    I have added a ComboBox to select the sheet from

    The add button will not be usable until a sheet is selected.

    Your code needs the sheet to be activated which is inefficient. I have edited the code to work without activating the sheet.

  • hi, Royuk you wrote some words incorrectly ;i corrected it doesn't matter but what's the difference between two files actually i don't check carefully it get me error runtime 91 in this line

    lastrow = .Cells(Rows.Count, 1).End(xlUp).Row + 1

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!