Rename New Worksheet
Sponsor
Excel Vba Question:
I kindly ask for help, ive a problem to rename new worksheet using excel vba function. In sheet1 i have a list, i need to create a new worksheet in a workbook and rename it with the value of cell which i selected in this list. I tried something like this, but it´s surely very simple
Sub Create()
Dim ws As Worksheet
Dim wsName As String
If Not IsEmpty(ActiveSheet.ActiveCell.Value) Then
Set ws = Worksheets.Add
ws.Move After:=Sheets(Sheets.Count)
ws.Name = ActiveSheet.ActiveCell.Text
End If
End Sub
Excel Vba Answer:
Small corrections of your excel vba function to rename new worksheet :
Sub Create()
Dim ws As Worksheet
Dim wsName As String
If Not IsEmpty(ActiveCell) Then
newname = ActiveCell.Value
Set ws = Worksheets.Add
ws.Move After:=Sheets(Sheets.Count)
ws.Name = newname
End If
End Sub
You have to do a small fix to the IsEmpty. You also need to capture the tab
name before the .Add
After the .Add the ActiveSheet becomes the new sheet, which is, of course,
a totally empty excel worksheet.
Rate This Tips:
Incoming excel search terms
vba rename worksheet,rename worksheet vba,excel vba rename worksheet,mss,vba rename sheet,excel vba create new worksheet,rename a worksheet vba,rename sheet vba,rename worksheet using vba,dim ws as worksheet,excel vba rename tab,rename a worksheet in vba,rename worksheet excel vba,vba rename excel worksheet,vba rename tab,excel vba rename,excel vba rename sheet,rename workbook vba,rename worksheet in excel vba,rename worksheet in vba,vba renaming worksheet,vba worksheet rename,adding and renaming worsheet,dynamically adding worksheet and renaming it,excel rename worksheet vba,excel vba copy and rename sheet,excel vba rename range,excel vba rename workbook,excel vba rename worksheets,excel vba sheet rename,rename a worksheet in excel vba,rename a worksheet using a list,rename a worksheet using vba,rename excel sheet vba,rename sheet in vba,rename sheets vba list,rename worksheet vba excel,rename worksheets vba,renaming a worksheet in vba,vba copy and rename worksheet,vba excel rename worksheet,vba rename a worksheet,vba rename worksheets,vba to rename worksheet,copy and rename worksheet vba,create and rename a new worksheet in a workbook,excel macro to rename a worksheet tab,excel rename sheet vba,excel rename worksheet macro,excel vb rename worksheet
Related Excel Tips
Comments
Have another excel answer or questions for this problem ?
Feel free to post it here..















(3 votes, average: 4.33 out of 5)