Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rename Tab with Textbox on Worksheet | Excel Programming | |||
rename the new worksheet | Excel Programming | |||
Using information from one worksheet, to rename inserted worksheet | Excel Worksheet Functions | |||
Rename the worksheet | Excel Discussion (Misc queries) | |||
Rename Textbox on Worksheets | Excel Programming |