PC Review


Reply
Thread Tools Rate Thread

Coding Today's Date In Visual Basic

 
 
lj
Guest
Posts: n/a
 
      7th Aug 2006
I'm writing some code in Visual Basic and want to to be able to name a
sheet today's date whenever the macro is run? Is there a way to do
this?

 
Reply With Quote
 
 
 
 
Mark
Guest
Posts: n/a
 
      7th Aug 2006

lj wrote:
> I'm writing some code in Visual Basic and want to to be able to name a
> sheet today's date whenever the macro is run? Is there a way to do
> this?


if you want to do this you are going to have to remove the "/"'s from
the date. Excel will not allow tham to be part of a worksheet name.

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      7th Aug 2006
Worksheets.Add.Name = Format(Date,"dd-mmm-yyyy")

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm writing some code in Visual Basic and want to to be able to name a
> sheet today's date whenever the macro is run? Is there a way to do
> this?
>



 
Reply With Quote
 
lj
Guest
Posts: n/a
 
      7th Aug 2006
Thanks, is there a way not to hardcode the date into VB but have visual
basic select the current date (similar to the way you can code excel to
display today's date)?

Bob Phillips wrote:
> Worksheets.Add.Name = Format(Date,"dd-mmm-yyyy")
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "lj" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I'm writing some code in Visual Basic and want to to be able to name a
> > sheet today's date whenever the macro is run? Is there a way to do
> > this?
> >


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      7th Aug 2006
That is what the code does.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"lj" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks, is there a way not to hardcode the date into VB but have visual
> basic select the current date (similar to the way you can code excel to
> display today's date)?
>
> Bob Phillips wrote:
> > Worksheets.Add.Name = Format(Date,"dd-mmm-yyyy")
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> > (replace somewhere in email address with gmail if mailing direct)
> >
> > "lj" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I'm writing some code in Visual Basic and want to to be able to name a
> > > sheet today's date whenever the macro is run? Is there a way to do
> > > this?
> > >

>



 
Reply With Quote
 
lj
Guest
Posts: n/a
 
      7th Aug 2006
Awesome!! Thanks!

Bob Phillips wrote:
> That is what the code does.
>
> --
> HTH
>
> Bob Phillips
>
> (replace somewhere in email address with gmail if mailing direct)
>
> "lj" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Thanks, is there a way not to hardcode the date into VB but have visual
> > basic select the current date (similar to the way you can code excel to
> > display today's date)?
> >
> > Bob Phillips wrote:
> > > Worksheets.Add.Name = Format(Date,"dd-mmm-yyyy")
> > >
> > > --
> > > HTH
> > >
> > > Bob Phillips
> > >
> > > (replace somewhere in email address with gmail if mailing direct)
> > >
> > > "lj" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I'm writing some code in Visual Basic and want to to be able to name a
> > > > sheet today's date whenever the macro is run? Is there a way to do
> > > > this?
> > > >

> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic Noob need help on coding a parameter for a multi-valu Jops Microsoft Access Form Coding 0 23rd Aug 2009 05:24 AM
visual basic coding question =?Utf-8?B?c3RldmllODg4?= Microsoft Excel Misc 0 26th Nov 2006 10:24 PM
Subform Visual Basic Coding Grassy7 Microsoft Access Forms 3 12th Jan 2006 05:00 PM
Combo Box coding on visual Basic.NET Robert Repsher via .NET 247 Microsoft VB .NET 3 25th Sep 2004 01:54 AM
Trying to create a Excel report from Visual Basic Coding =?Utf-8?B?SmFzcGVy?= Microsoft Access Getting Started 1 16th Dec 2003 09:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:37 AM.