Convert worksheet string name to date format in cell

S

Sabosis

Hello-

I have a workbook that will always have a sheet name such as 082509. I
want to have cell J2 take that string and convert to a MM/DD/YY
format. I tried the following, but it did not work:

Range("J2").Select
ActiveCell.FormulaR1C1 = DateValue(Format(Range(Worksheet
(1)).Value, "00/00/00"))

Any ideas?

Thanks
 
D

Dave Peterson

maybe...

I'd use:

With ActiveSheet.Range("J2")
.NumberFormat = "mm/dd/yy" 'whatever you want
.Value = DateValue(Format(Worksheets(1).Name, "00/00/00"))
End With
 
S

Sabosis

maybe...

I'd use:

With ActiveSheet.Range("J2")
    .NumberFormat = "mm/dd/yy" 'whatever you want
    .Value = DateValue(Format(Worksheets(1).Name, "00/00/00"))
End With

Dave, thanks for the help!
 

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