ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Check for a tab if it is exist (https://www.excelbanter.com/excel-discussion-misc-queries/214378-check-tab-if-exist.html)

Farhad

Check for a tab if it is exist
 
Hi all,

i want to check in an Excel file for a tab name for example "AAA" and see if
this tab name is exist in the file or not everyone please help me.

Thanks,
--
Farhad Hodjat

Frederik[_3_]

Check for a tab if it is exist
 
Have a look at

http://spreadsheetpage.com/index.php...vba_functions/

Success!!

--
met vriendelijke groetjes


"Farhad" schreef in bericht
...
Hi all,

i want to check in an Excel file for a tab name for example "AAA" and see
if
this tab name is exist in the file or not everyone please help me.

Thanks,
--
Farhad Hodjat




Rick Rothstein

Check for a tab if it is exist
 
Something like this function should work...

Private Function SheetExists(sname) As Boolean
On Error Resume Next
IsError ActiveWorkbook.Sheets(sname)
SheetExists = Err.Number = 0
End Function

Just call it from your own code (macro, function, event procedure, etc.)
like this...

MsgBox SheetExists("AAA")

The function returns True if the sheet exists and False if it doesn't exist.

--
Rick (MVP - Excel)


"Farhad" wrote in message
...
Hi all,

i want to check in an Excel file for a tab name for example "AAA" and see
if
this tab name is exist in the file or not everyone please help me.

Thanks,
--
Farhad Hodjat




All times are GMT +1. The time now is 08:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com