View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Paul Robinson Paul Robinson is offline
external usenet poster
 
Posts: 208
Default Add sheet and rename with cell contents

Hi Rudy,
For sheet names, you must avoid certain characters like / and ,
(comma). So you must format the date correctly.

ActiveSheet.Name = Format(Range("A1").Value, "dd mmm yyyy")

Note that formatting the date in the cell and then using

ActiveSheet.Name = Range("A1").Value

will not work as it will lift the date value in mm/dd/yyyy format (it
did on my machine), which then generates an error.

regards
Paul

"Rudy Woltner" wrote in message ...
Here's what I'm trying to do:

We pull some server data using a VBS script, which is
then placed in a .csv file. To make things easier on the
non-excel users, I want ot automate putting the data in
the workbook. So my goal is to have a macro that they run
that does the following:

Inserts new sheet
Imports data from the file
Adds a column
Creates a new formula and pastes it down through the
column
Defines a few names in the sheet
Places the current date in a cell
Date is replaced as a value so it doesn't change
Use date value as sheet name.

I'm good to go all the way down to the last part "Use
date value as sheet name". So if the date value ends up
in J1, how can I get that value as the sheet name?

Thanks a bunch,

Rudy