LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Change Tag Name Automatically

Norman;
Thanks for your quick response and your advice.

I did the following:
1.- I typed the date in the cells D15, D16, D17 then I ran the program and
it is working very well.

2.- I have sheets under the names; Input, Data, Sheet1, Sheet2,
Sheet3,€¦€¦..Sheet10.
The program renamed the Input, Data, and Sheet1. I wonder if the program can
rename just the sheet# only; starting from Sheet1 to Sheet 10 and keep the
Input and Data names.

3.- Then after I did the step 1. I typed the date in the cell D18 and I got
the following error message:
Run-time error9:
Subscript out of range
Then I click debug it is highlighting at :
Set SH = ActiveWorkbook.Sheets("Information")

Do you think it is possible to make adjust it.
I will really appreciate it.

Best regards.
Maperalia





"Norman Jones" wrote:

Hi Maperalia,

Try:

'============
Sub TesterX()
Dim SH As Worksheet
Dim rng As Range
Dim i As Long
Dim sStr As String

Set SH = ActiveWorkbook.Sheets("Information")
Set rng = SH.Range("D15:D24")

On Error Resume Next
For i = 1 To rng.Cells.Count
sStr = Format(rng(i).Value, "mm-dd-yyyy")
Sheets(i).Name = sStr
Next i
On Error GoTo 0

End Sub
'<<============

---
Regards,
Norman


"maperalia" wrote in message
...
I have this program that changes the sheet name automatically (see below).
However, I got the following problems:

1.- When one of the cell does not have information the program does not
continue just stop.
2.- If the cell D15, D16 and D17 have number. The program changes these
tag's names. However, stops as soon find that the next cell is empty.

I need the program to just change the sheet names that have description in
the cells.

Could you please help me with this matter?

Thank in advance.
Maperalia

'****START PROGRAM***********
Option Explicit

Sub RenameSheets()
Dim myDateTime As String

myDateTime = Format(Worksheets("Information").Range("D15").Valu e,
"mm-dd-yyyy")
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D16").Valu e,
"mm-dd-yyyy")
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D17").Valu e,
"mm-dd-yyyy")
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D18").Valu e,
"mm-dd-yyyy")
Sheets("Sheet4").Select
Sheets("Sheet4").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D19").Valu e,
"mm-dd-yyyy")
Sheets("Sheet5").Select
Sheets("Sheet5").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D20").Valu e,
"mm-dd-yyyy")
Sheets("Sheet6").Select
Sheets("Sheet6").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D21").Valu e,
"mm-dd-yyyy")
Sheets("Sheet7").Select
Sheets("Sheet7").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D22").Valu e,
"mm-dd-yyyy")
Sheets("Sheet8").Select
Sheets("Sheet8").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D23").Valu e,
"mm-dd-yyyy")
Sheets("Sheet9").Select
Sheets("Sheet9").Name = "" & myDateTime & ""

myDateTime = Format(Worksheets("Information").Range("D24").Valu e,
"mm-dd-yyyy")
Sheets("Sheet10").Select
Sheets("Sheet10").Name = "" & myDateTime & ""

End Sub
'****END PROGRAM***********




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having a value automatically change color John Excel Worksheet Functions 5 February 1st 09 07:31 PM
All values automatically change to zero Ricky Excel Discussion (Misc queries) 1 July 5th 05 04:07 PM
How do I automatically change text Monty Excel Discussion (Misc queries) 3 March 17th 05 09:48 PM
Automatically change tab reference TWC Excel Discussion (Misc queries) 2 February 2nd 05 10:17 PM
how do i make a date change automatically if i change one before . dpl7579 Excel Discussion (Misc queries) 1 January 11th 05 09:21 PM


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"