Simple VBA programming in Excel

W

wagee

I am trying to write a simple VBA program for a spreadsheet. However I
am stuck. I am learning this as I go along so that is the big problem
no doubt. I need to copy a sheet and rename. Simple eh? I copy it no
problem but cannot figure how to change the copyed name (now
firstname(2) for instance) to a new name. A cut out of the utility is
below:

Private Sub copysht()
sname = "dog"
Sheets("Template").Copy after:=Worksheets(Worksheets.Count) '.name
= "sname" 'copy at the end
Sheets("Template(2)").name = "sname"
'ActiveWorkbook.Sheets("Template(2)").name = "sname" 'give sheet a new
name but it blows up on Template(2)!
End Sub
 
M

md

You would have a better chance of getting an answer if you post to a
newsgroup on VBA or Excel. This is a .Net programming group.
 
W

wagee

You would have a better chance of getting an answer if you post to a
newsgroup on VBA or Excel. This is a .Net programming group.







- Show quoted text -

Thanks for the pointing that I hopefully I found one.

Wayne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top