Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default rename worksheet

I have a workbook with worksheets. The first is a plan for a quoter and other
3 are
monthly reports. Each report sheet has 2 textboxes, one for month and one
for year.
Textboxes receive data from respective linked cells.
Both text boxes receive data from the linked cell which have formulas to
select a month and a Year.
I tried several codes which work perfectly when you enter the data directly
into the text boxes (or directly into the cell for the name of the worksheet
if you want to rename cell from the range). But when I tried to use formula
in the linked cell it stopped to work.
Could you please help me to have report tabs renamed automatically when
values of the linked cells (or text boxes) are changed by formula.
Thanks/Vladimir


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default rename worksheet

For more accurate analysis and advice, post the relevant code or formulas
that are not working the way you expect them to.

"Vladimir" wrote:


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default rename worksheet

Private Sub TextBox1_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

Private Sub TextBox2_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

When user entered new date in sheet 1, in each sheet 2, 3 & 4 two text
boxes (one for Month and 1 for Year) will change. I need that same time each
sheet 2, 3 & 4 to be renamed "Month & Year".
Text boxes in each sheet 2, 3, & 4 change from linked cells which change by
formula.
:), hope didn't make it too complicated.

"Vladimir" wrote:

I have a workbook with 4 worksheets. The first is a plan for a quoter and other
3 are
monthly reports. Each report sheet has 2 textboxes, one for month and one
for year.
Textboxes receive data from respective linked cells.
Both text boxes receive data from the linked cell which have formulas to
select a month and a Year.
I tried several codes which work perfectly when you enter the data directly
into the text boxes (or directly into the cell for the name of the worksheet
if you want to rename cell from the range). But when I tried to use formula
in the linked cell it stopped to work.
Could you please help me to have report tabs renamed automatically when
values of the linked cells (or text boxes) are changed by formula.
Thanks/Vladimir


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default rename worksheet

If you put a formula in the linked cell, you destroy the link. You can,
however, put code behind the TextBox that puts the cell value of a formula in
the TextBox. For example:

Private Sub TextBox1_Enter()
Me.TextBox1.Value = Range("A1").Value
End Sub

Private Sub TextBox1_Exit()
Me.TextBox1.Value = ""
End Sub

I don't believe the TextBox uses the GotFocus property.

"Vladimir" wrote:

Private Sub TextBox1_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

Private Sub TextBox2_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

When user entered new date in sheet 1, in each sheet 2, 3 & 4 two text
boxes (one for Month and 1 for Year) will change. I need that same time each
sheet 2, 3 & 4 to be renamed "Month & Year".
Text boxes in each sheet 2, 3, & 4 change from linked cells which change by
formula.
:), hope didn't make it too complicated.

"Vladimir" wrote:

I have a workbook with 4 worksheets. The first is a plan for a quoter and other
3 are
monthly reports. Each report sheet has 2 textboxes, one for month and one
for year.
Textboxes receive data from respective linked cells.
Both text boxes receive data from the linked cell which have formulas to
select a month and a Year.
I tried several codes which work perfectly when you enter the data directly
into the text boxes (or directly into the cell for the name of the worksheet
if you want to rename cell from the range). But when I tried to use formula
in the linked cell it stopped to work.
Could you please help me to have report tabs renamed automatically when
values of the linked cells (or text boxes) are changed by formula.
Thanks/Vladimir


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default rename worksheet

Dear "JLGWhiz",
Thanks for your reply. To be honest I'm absolute 0 in the VBA and the only
thing I'm able to do is to paste your code in the code of the worksheet and
it does not change the sheet name as I need.
If possible could you give me complete code for my purpose, please .
Vladimir
wrote:

If you put a formula in the linked cell, you destroy the link. You can,
however, put code behind the TextBox that puts the cell value of a formula in
the TextBox. For example:

Private Sub TextBox1_Enter()
Me.TextBox1.Value = Range("A1").Value
End Sub

Private Sub TextBox1_Exit()
Me.TextBox1.Value = ""
End Sub

I don't believe the TextBox uses the GotFocus property.

"Vladimir" wrote:

Private Sub TextBox1_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

Private Sub TextBox2_LostFocus()
On Error Resume Next
ActiveSheet.name = Me.TextBox1.Value & Me.TextBox2.Value
End Sub

When user entered new date in sheet 1, in each sheet 2, 3 & 4 two text
boxes (one for Month and 1 for Year) will change. I need that same time each
sheet 2, 3 & 4 to be renamed "Month & Year".
Text boxes in each sheet 2, 3, & 4 change from linked cells which change by
formula.
:), hope didn't make it too complicated.

"Vladimir" wrote:

I have a workbook with 4 worksheets. The first is a plan for a quoter and other
3 are
monthly reports. Each report sheet has 2 textboxes, one for month and one
for year.
Textboxes receive data from respective linked cells.
Both text boxes receive data from the linked cell which have formulas to
select a month and a Year.
I tried several codes which work perfectly when you enter the data directly
into the text boxes (or directly into the cell for the name of the worksheet
if you want to rename cell from the range). But when I tried to use formula
in the linked cell it stopped to work.
Could you please help me to have report tabs renamed automatically when
values of the linked cells (or text boxes) are changed by formula.
Thanks/Vladimir


Reply
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
Can't rename worksheet Brian Preston Excel Discussion (Misc queries) 1 October 15th 06 03:25 AM
Using information from one worksheet, to rename inserted worksheet Lyn Excel Worksheet Functions 0 March 24th 06 12:54 AM
Rename the worksheet praveen_khm Excel Discussion (Misc queries) 1 January 17th 06 08:05 PM
Add and rename a worksheet Microsoft Forum Excel Programming 1 December 14th 04 11:28 AM
Rename worksheet Donald Duck Excel Programming 3 August 17th 04 10:15 AM


All times are GMT +1. The time now is 11:24 PM.

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"