Dim CustomerWorkbook As Workbook
Dim Sheet As Worksheet
Set CustomerWorkbook = Workbooks.Open("Customer Workbook.xls")
' if the workbook only has one sheet then rename it else search each sheet
' for some kind of identifying mark such as a page title, etc.
If CustomerWorkbook.Worksheets.Count = 1 Then
CustomerWorkbook.Worksheets(1).Name = "Sheet1"
Else
For Each Sheet In CustomerWorkbook.Worksheets
If Sheet.Range("A1") = "Customer Data" Then
Sheet.Name = "Sheet1"
Exit For
End If
Next Sheet
End If
"Vijay Kotian" wrote:
I think the problem is not explained to you correctly.
I process the file based on file received by me from our customers. In the
file, sheet is named differenly (depending upon client to client).
Hence, i need some solution, wherein i can rename the sheet name to sheet1.
In other words i would like to rename sheet to sheet1 (the original sheet
name may be vijay or March or Wednesday etc).
How to rename unknown sheet name through VBA program
"Nigel" wrote:
Use the sheet index, not the sheet name.
So refer to the sheet as..... Sheets(1)
--
Regards,
Nigel
"Vijay Kotian" wrote in message
...
I am getting a file wherein the name of the worksheet is not unique and i
am
finding it dffficult to rename through program.
Can anyone help me out to rename a worksheet which is named differently
every time and normally only one worksheet is found in workbook.
Thank you in advance