Dynamic naming of worksheets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I am developing a macro in which I add new sheets to a database every time I
export data to it. In order to recognize these sheets, I would like to be
able to make the name of the sheet equal to the contents of a cell in the
exported sheet. Currently, the code reads

Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Name"

Is there anyway that I can make the "Name" - part into a dynamic
cell-reference?

Thanks
Zyvind
 
Just use:


Sheets("Sheet1").Name = Sheets("Sheet1").Range("A1")

or

Sheets("Sheet1").Name = yourStringVariableHere

or

Sheets("Sheet1").Name = Sheets("Sheet1").Range
(yourrangenamevariable)

or

Sheets("Sheet1").Name = Sheets("Sheet1").cells(1,1)


etc

ttfn benm
 

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

Back
Top