sheet name VBA

J

Jack

Hi

I just wonder how to change a sheet name the from vba code in excel..

Thanks for your help

Jac
 
R

Ron de Bruin

Try this Jack

Sub test()
On Error Resume Next
ActiveSheet.Name = "Hi"
On Error GoTo 0
End Sub
 
B

Bob Flanagan

ActiveSheet.Name ="new name"

or

worksheets("sheet1").Name ="New Name"

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
H

Harald Staff

Hi Jack

Adding: When you're stuck on simple operations and their syntax, record a
macro while doing it manually:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 09.06.2004 by Harald Staff
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Joe"
End Sub

HTH. Best wishes Harald
 
Top