Rename unknown sheet name in excel.

  • Thread starter Thread starter Vijay Kotian
  • Start date Start date
V

Vijay Kotian

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
 
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
 
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
 
I am happy enough writing macros but want some help to ensure I can
write the one I want!

I have a spreadsheet with pupil details in columns A-C, and then
currently in columns D-AA I hold marking details for student progress.

What I want to be able to do is each time a student's marks change, I
want to place the date in a helper column for the date of the most
recent change to the row. And what I really want is it to display
(maybe in another column) "Today" if it has changed today, "Week" if
it has changed in the last week, and "Month" if it has changed in the
last month. If over a month, then "Warning" needs to be displayed.

Any help gratefully received.

Noz
 
Back
Top