verify if spesific sheet exist
hi,
i created a macro.... i need to check if the active work book has a sheet named "xxx". do you know how should i do that? thanks in advance. -- Miri Tz. |
verify if spesific sheet exist
Try this which is case sensitive
Sub isthereanybodythere() Dim ws As Worksheet msg = "What sheet are you looking for" response = InputBox(msg) For Each ws In ActiveWorkbook.Worksheets Name = ws.Name Worksheets(Name).Select If response = Name Then msg = Name + " Sheet exists" MsgBox (msg) End If Next ws End Sub "Miri" wrote: hi, i created a macro.... i need to check if the active work book has a sheet named "xxx". do you know how should i do that? thanks in advance. -- Miri Tz. |
verify if spesific sheet exist
"Miri" wrote: hi, i created a macro.... i need to check if the active work book has a sheet named "xxx". do you know how should i do that? thanks in advance. -- Miri Tz. Hi , You could write a macro like the one shown below Sub Surch() a = Inputbox("Enter the name of the worksheet you want to search for:") For each ws in worksheets ws.select If activesheet.name = a then Msgbox ("This workbook has a sheet named " & a) Goto last Endif Next last:End Sub This will do the trick VJ |
verify if spesific sheet exist
One mo
dim testWks as worksheet set testwks = nothing on error resume next set testwks = activeworkbook.worksheets("xxx") on error goto 0 if testwks is nothing then 'doesn't exist else 'yep, it's there end if Miri wrote: hi, i created a macro.... i need to check if the active work book has a sheet named "xxx". do you know how should i do that? thanks in advance. -- Miri Tz. -- Dave Peterson |
All times are GMT +1. The time now is 12:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com