I am trying to see whether a sheet exists or not and if it doesnt exist, I try to add a sheet and enter some data.

The first issue I face is that

when ever I try to add a worksheet it gets added in the beginning. But the sheet should be added last for which I use '''Set wsheet = RC_Workbook.Worksheets.Add(After:=Worksheets(Works heets.Count - 1))" . This throws an error when executed. So I add normally.

The Second issue when I do this is that,

when I try to save after entering the data,and when I open that workbook, the workbook gets hided. I have to manually click on the unhide button and view the workbook.

Please find the code I use below.


For i = 1 To RC_Workbook.Worksheets.Count
If RC_Workbook.Worksheets(i).Name = Day Then
WS_found = "Yes"
End If
Next i

If WS_found = "No" Then


'Set wsheet = RC_Workbook.Worksheets.Add(After:=Worksheets(Works heets.Count - 1))
RC_Workbook.ActiveSheet.Name = Day
Set RC_Workbook = Nothing
End If

Thanks, Awaiting your valuable reply.