PC Review


Reply
Thread Tools Rate Thread

Auto date in VBA

 
 
BMeredith
Guest
Posts: n/a
 
      24th Nov 2006
First off, I appologize if this had been posted before. I have been looking
for a while now and cannot find the exact answer I need. I know it is going
to be very basic, yet have no luck doing it on my own. Thank you in advace
to all of you who may help me. Anyways, I am trying to write simple code to
update a cell value with the Text "Week of" and then calculate the first day
of the previous work week (Sunday) in mm/dd format. If this is not possible,
I am fine with the Today -7 function, but cannot get that to work. Here is
the code I have been working with and get an error on the Text portion alone.

Range("c2,c13,k13").Value = "Week of" & (Text(Today - 7, "mm/dd"))

Again, thank you to all who helps me with this.

Brandon

 
Reply With Quote
 
 
 
 
BMeredith
Guest
Posts: n/a
 
      24th Nov 2006
My appologies, I'm sure you all would know this, but I am getting a Sub or
function not defined error.

BMeredith wrote:
>First off, I appologize if this had been posted before. I have been looking
>for a while now and cannot find the exact answer I need. I know it is going
>to be very basic, yet have no luck doing it on my own. Thank you in advace
>to all of you who may help me. Anyways, I am trying to write simple code to
>update a cell value with the Text "Week of" and then calculate the first day
>of the previous work week (Sunday) in mm/dd format. If this is not possible,
>I am fine with the Today -7 function, but cannot get that to work. Here is
>the code I have been working with and get an error on the Text portion alone.
>
>Range("c2,c13,k13").Value = "Week of" & (Text(Today - 7, "mm/dd"))
>
>Again, thank you to all who helps me with this.
>
>Brandon


 
Reply With Quote
 
BMeredith
Guest
Posts: n/a
 
      24th Nov 2006
Ok,

I got it to work witht he now function, but I do not need the time. Is
there another function that will just give me the day.



BMeredith wrote:
>First off, I appologize if this had been posted before. I have been looking
>for a while now and cannot find the exact answer I need. I know it is going
>to be very basic, yet have no luck doing it on my own. Thank you in advace
>to all of you who may help me. Anyways, I am trying to write simple code to
>update a cell value with the Text "Week of" and then calculate the first day
>of the previous work week (Sunday) in mm/dd format. If this is not possible,
>I am fine with the Today -7 function, but cannot get that to work. Here is
>the code I have been working with and get an error on the Text portion alone.
>
>Range("c2,c13,k13").Value = "Week of" & (Text(Today - 7, "mm/dd"))
>
>Again, thank you to all who helps me with this.
>
>Brandon


 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      24th Nov 2006
It is Date in VBA.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"BMeredith" <u29549@uwe> wrote in message news:69c85cb727ed6@uwe...
> Ok,
>
> I got it to work witht he now function, but I do not need the time.

Is
> there another function that will just give me the day.
>
>
>
> BMeredith wrote:
> >First off, I appologize if this had been posted before. I have been

looking
> >for a while now and cannot find the exact answer I need. I know it is

going
> >to be very basic, yet have no luck doing it on my own. Thank you in

advace
> >to all of you who may help me. Anyways, I am trying to write simple

code to
> >update a cell value with the Text "Week of" and then calculate the first

day
> >of the previous work week (Sunday) in mm/dd format. If this is not

possible,
> >I am fine with the Today -7 function, but cannot get that to work. Here

is
> >the code I have been working with and get an error on the Text portion

alone.
> >
> >Range("c2,c13,k13").Value = "Week of" & (Text(Today - 7, "mm/dd"))
> >
> >Again, thank you to all who helps me with this.
> >
> >Brandon

>



 
Reply With Quote
 
=?Utf-8?B?TWlrZSBRLg==?=
Guest
Posts: n/a
 
      24th Nov 2006
> I got it to work witht he now function
How about an ugly if function
=IF(WEEKDAY(TODAY())=2,TODAY()-1,IF(WEEKDAY(TODAY())=3,TODAY()-2,IF(WEEKDAY(TODAY())=4,TODAY()-3,IF(WEEKDAY(TODAY())=5,TODAY()-4,IF(WEEKDAY(TODAY())=6,TODAY()-5,IF(WEEKDAY(TODAY())=7,TODAY()-6,TODAY()))))))
You could always give it a name to you don't loose half you screen when you
look at it.

--
Mike Q.


"BMeredith" wrote:

> Ok,
>
> I got it to work witht he now function, but I do not need the time. Is
> there another function that will just give me the day.
>
>
>
> BMeredith wrote:
> >First off, I appologize if this had been posted before. I have been looking
> >for a while now and cannot find the exact answer I need. I know it is going
> >to be very basic, yet have no luck doing it on my own. Thank you in advace
> >to all of you who may help me. Anyways, I am trying to write simple code to
> >update a cell value with the Text "Week of" and then calculate the first day
> >of the previous work week (Sunday) in mm/dd format. If this is not possible,
> >I am fine with the Today -7 function, but cannot get that to work. Here is
> >the code I have been working with and get an error on the Text portion alone.
> >
> >Range("c2,c13,k13").Value = "Week of" & (Text(Today - 7, "mm/dd"))
> >
> >Again, thank you to all who helps me with this.
> >
> >Brandon

>
>

 
Reply With Quote
 
BMeredith via OfficeKB.com
Guest
Posts: n/a
 
      25th Nov 2006
That was it, thank you Bob. I knew it was something stupid, lol. Thanks
again.

Bob Phillips wrote:
>It is Date in VBA.
>
>--
>
>HTH
>
>Bob Phillips
>
>(replace xxxx in the email address with gmail if mailing direct)
>
>> Ok,
>>

>[quoted text clipped - 15 lines]
>> >
>> >Brandon


--
Message posted via http://www.officekb.com

 
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
Auto initials & auto date not working properly GD Microsoft Access Getting Started 7 24th Feb 2009 02:33 PM
How do I set a cell to auto populate the date to show the current week's Friday date? SaipanRick Microsoft Excel Discussion 4 10th Feb 2008 08:01 PM
Auto Protecting cells & auto filling date ccarmock Microsoft Excel Misc 7 30th Sep 2005 09:21 PM
Excel: auto-calculate a date 2 weeks after an initial date =?Utf-8?B?c2ZmYW4yMDA0?= Microsoft Excel Worksheet Functions 0 22nd Sep 2004 09:05 PM
Excel Date - Auto enter file creation date (free chocolate for help) arielax Microsoft Excel Misc 6 29th Apr 2004 02:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:52 PM.