View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tango tango is offline
external usenet poster
 
Posts: 45
Default if statement for sheet not found in workbook

dear all,
i want to add new worksheet if the worksheet name is not found in the
workbook when user input in the inputbox.

tosheet is the variable input by user.

** this if statement is incorrect. how should i write the statement?
If Worksheets(tosheet).Name not found in the workbook then

** this line is correct.
Set ws = ThisWorkbook.Worksheets.Add(after:=ThisWorkbook.Sh eets(ThisWorkbook.Sheets.Count))

End If


thanks alot