Using cell references in Excel Macros

  • Thread starter Thread starter Michelle Ann
  • Start date Start date
M

Michelle Ann

I'm trying to write a macro that will add a new worksheet to an existin
workbook, rename the new sheet with a name that's in a range of cell
(A5:D5 in this case) return to the original worksheet and clear th
infomation from selected cells.
Everything works, except that the line which renames the ne
worksheet has a literal string (pervious cell information) in it. Ho
can I make reference to the cell which contains the date instead of th
data itself, so tha each time the macro runs it'll name the sheet wit
the new data? Or is this even possible?

Thanking you
Michelle An
 
You can refer to a cell's value when you name the sheet:

Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = Sheets("Sheet1").Range("C3").Value
 

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