I have a work bookI don't know how many worksheets in the, but I have to write in every worksheet in a workbook some text (for example "hello world" in cell A1. I don't know worksheets number but I have to put some text in every worksheet.
this searches for a specific workbook but you can use the .Name property to get the names of all of the worksheets in your workbook
Public Function FindSheet(ByRef xlWbk As Excel.Workbook, _
ByVal SheetName As String) As Boolean
Dim i As Integer
Dim NumberOfWorksheets As Integer
NumberOfWorksheets = xlWbk.Sheets.Count
For i = 1 To NumberOfWorksheets
If (xlWbk.Sheets(i).Name = SheetName) Then
FindSheet = True
Exit Function
End If
Next i
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.