Hi oldjay,
If you use the original code I posted it should work under all situations.
--
Regards,
OssieMac
"oldjay" wrote:
> You guys have got me confused. What is the final code. I do not care about
> the date format. What ever is the easiest.
>
> oldjay
>
> "Peter T" wrote:
>
> > Hello OssieMac,
> >
> > No that's no problem, try this -
> >
> > MsgBox Replace("abc", "x", "y") ' abc
> >
> > Probably I'd use the Format function. However if I wanted to distribute I
> > wouldn't want to prejudge if user wants dd-mm-yyyy or mm-dd-yyyy. The
> > Replace function is a simple way to ensure no slashes appear without
> > changing the order, and an as an alternative to what you had already
> > suggested, I did indicate. Of course there are other ways too, not least
> > Format.
> >
> > Not sure if Date could ever be returned with some other invalid characters,
> > if so would need to think again.
> >
> > Regards,
> > Peter T
> >
> >
> > "OssieMac" <(E-Mail Removed)> wrote in message
> > news:4EF6C6A4-81B7-425D-8F2C-(E-Mail Removed)...
> > > Hi Peter,
> > >
> > > It is better to use code that will work for all users.
> > > ActiveSheet.Name = Replace(Date, "/", "-") will fail if the user does not
> > > have slashes in the date format.
> > >
> > > By using the Format function you can set the sheet name with characters
> > > that
> > > you know will not fail irrespective of the user's default date format.
> > >
> > > --
> > > Regards,
> > >
> > > OssieMac
> > >
> > >
> > > "Peter T" wrote:
> > >
> > >> As OssieMac points out best ensure there are no "/" in the new sheet name
> > >> change
> > >>
> > >> > ActiveSheet.Name = Date
> > >>
> > >> to (one way)
> > >> ActiveSheet.Name = Replace(Date, "/", "-")
> > >>
> > >> (my default format is has "-" separators hence I forgot)
> > >>
> > >> Regards,
> > >> Peter T
> > >>
> > >>
> > >> "Peter T" <peter_t@discussions> wrote in message
> > >> news:ONF%(E-Mail Removed)...
> > >> > Sub test()
> > >> > Dim ws As Worksheet
> > >> > Set ws = Worksheets("Sheet1")
> > >> > ws.Copy after:=ws
> > >> >
> > >> > ' will fail if a sheet named today's date already exits
> > >> > ActiveSheet.Name = Date
> > >> > End Sub
> > >> >
> > >> > This will copy the controls and code behind the sheet, as well as
> > >> > contents.
> > >> >
> > >> > Regards,
> > >> > Peter T
> > >> >
> > >> > "oldjay" <(E-Mail Removed)> wrote in message
> > >> > news:CE711085-5B76-4C3B-A028-(E-Mail Removed)...
> > >> >>I want to copy a sheet and its command buttons to a new sheet named for
> > >> >>the
> > >> >> present date i.e.(11/24/09). Buttons created from the Toolbox in Excel
> > >> >> 2003
> > >> >>
> > >> >> oldjay
> > >> >
> > >> >
> > >>
> > >>
> > >> .
> > >>
> >
> >
> > .
> >
|