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

I have 10 tabs that I will need to rename from a textbox (not the range in
the code below). The following code has to be ran first, then backtrack to
rename the appropriate tabs to the value in the textbox. Anyone have any
ideas?

Range("P5:R5").Copy
For sh = 2 To Sheets.Count
If Sheets(sh).Name Like ("Request*") Then
ActiveSheet.Paste Destination:=Sheets(sh).Range("P5:R5")
End If
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Textbox value - rename worksheet with

Dim wsName As String
Dim WS_Count As Integer
Dim i As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For i = 1 To WS_Count
wsName = Textbox1.value & i
On Error Resume Next
ActiveWorkbook.Worksheets(i).Name = & wsName
Next i

"LRay67" wrote:

I have 10 tabs that I will need to rename from a textbox (not the range in
the code below). The following code has to be ran first, then backtrack to
rename the appropriate tabs to the value in the textbox. Anyone have any
ideas?

Range("P5:R5").Copy
For sh = 2 To Sheets.Count
If Sheets(sh).Name Like ("Request*") Then
ActiveSheet.Paste Destination:=Sheets(sh).Range("P5:R5")
End If
Next
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Textbox value - rename worksheet with

Mike,

I tried the code below, but it is not working. The
ActiveWorkbook.Worksheets(i).Name = & wsName (code) comes up in red.
Another co-worker & I have been trying to figure this out, but are unable to.
Any suggestions??

"Mike" wrote:

Dim wsName As String
Dim WS_Count As Integer
Dim i As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For i = 1 To WS_Count
wsName = Textbox1.value & i
On Error Resume Next
ActiveWorkbook.Worksheets(i).Name = & wsName
Next i

"LRay67" wrote:

I have 10 tabs that I will need to rename from a textbox (not the range in
the code below). The following code has to be ran first, then backtrack to
rename the appropriate tabs to the value in the textbox. Anyone have any
ideas?

Range("P5:R5").Copy
For sh = 2 To Sheets.Count
If Sheets(sh).Name Like ("Request*") Then
ActiveSheet.Paste Destination:=Sheets(sh).Range("P5:R5")
End If
Next
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Textbox value - rename worksheet with

Try this
Sub WorksheetLoop()
Dim wsName As String
Dim WS_Count As Integer
Dim i As Integer
WS_Count = _
ActiveWorkbook.Worksheets.Count
' Begin the loop.
For i = 1 To WS_Count
wsName = "wk" & i
On Error Resume Next
ActiveWorkbook.Worksheets(i).Name = _
wsName
Next i
End Sub

"LRay67" wrote:

Mike,

I tried the code below, but it is not working. The
ActiveWorkbook.Worksheets(i).Name = & wsName (code) comes up in red.
Another co-worker & I have been trying to figure this out, but are unable to.
Any suggestions??

"Mike" wrote:

Dim wsName As String
Dim WS_Count As Integer
Dim i As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
' Begin the loop.
For i = 1 To WS_Count
wsName = Textbox1.value & i
On Error Resume Next
ActiveWorkbook.Worksheets(i).Name = & wsName
Next i

"LRay67" wrote:

I have 10 tabs that I will need to rename from a textbox (not the range in
the code below). The following code has to be ran first, then backtrack to
rename the appropriate tabs to the value in the textbox. Anyone have any
ideas?

Range("P5:R5").Copy
For sh = 2 To Sheets.Count
If Sheets(sh).Name Like ("Request*") Then
ActiveSheet.Paste Destination:=Sheets(sh).Range("P5:R5")
End If
Next
End Sub

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
Rename Tab with Textbox on Worksheet LRay67 Excel Programming 3 March 12th 08 02:23 PM
rename the new worksheet raraschek Excel Programming 5 April 2nd 07 06:58 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
Rename Textbox on Worksheets Darren Hill[_3_] Excel Programming 16 June 18th 05 09:27 PM


All times are GMT +1. The time now is 09:06 AM.

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

About Us

"It's about Microsoft Excel"