![]() |
What's command for find sheets exist in workbooks?
I need your help for command of VBA
what's command for "find sheets("A")=ture" please refer to under information. if "find sheets("A")=ture" then Worksheets("A").Delete end if ActiveWorkbook.Worksheets.Add rename = ActiveSheet.Name Worksheets(rename).Name = "A" |
What's command for find sheets exist in workbooks?
This should help
Private Sub CommandButton1_Click() For i = 1 To ActiveWorkbook.Worksheets.Count Worksheets(i).Select If Worksheets(i).Name = "Sheet3" Then MsgBox (Worksheets(i).Name) Next End Sub -- -John Please rate when your question is answered to help us and others know what is helpful. "Jennifer" wrote: I need your help for command of VBA what's command for "find sheets("A")=ture" please refer to under information. if "find sheets("A")=ture" then Worksheets("A").Delete end if ActiveWorkbook.Worksheets.Add rename = ActiveSheet.Name Worksheets(rename).Name = "A" |
What's command for find sheets exist in workbooks?
if SheetExists("A")=True then
application.Dispalyalerts = false Worksheets("A").Delete application.DisplayAlerts = True end if ActiveWorkbook.Worksheets.Add ActiveSheet.Name = "A" .... End sub Public Function SheetExists(SName As String, _ Optional ByVal Wb As Workbook) As Boolean 'Chip Pearson On Error Resume Next If Wb Is Nothing Then Set Wb = ThisWorkbook SheetExists = CBool(Len(Wb.Sheets(SName).Name)) End Function -- HTH... Jim Thomlinson "Jennifer" wrote: I need your help for command of VBA what's command for "find sheets("A")=ture" please refer to under information. if "find sheets("A")=ture" then Worksheets("A").Delete end if ActiveWorkbook.Worksheets.Add rename = ActiveSheet.Name Worksheets(rename).Name = "A" |
What's command for find sheets exist in workbooks?
Thanks so much
nice got your answer. It was a successful experiment on my project. Thanks again! "Jim Thomlinson" wrote: if SheetExists("A")=True then application.Dispalyalerts = false Worksheets("A").Delete application.DisplayAlerts = True end if ActiveWorkbook.Worksheets.Add ActiveSheet.Name = "A" ... End sub Public Function SheetExists(SName As String, _ Optional ByVal Wb As Workbook) As Boolean 'Chip Pearson On Error Resume Next If Wb Is Nothing Then Set Wb = ThisWorkbook SheetExists = CBool(Len(Wb.Sheets(SName).Name)) End Function -- HTH... Jim Thomlinson "Jennifer" wrote: I need your help for command of VBA what's command for "find sheets("A")=ture" please refer to under information. if "find sheets("A")=ture" then Worksheets("A").Delete end if ActiveWorkbook.Worksheets.Add rename = ActiveSheet.Name Worksheets(rename).Name = "A" |
All times are GMT +1. The time now is 11:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com