Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA code for date change? (Newbie)

Hi....

I have 33,000 rows with jobs in them - in one of the columns there is
a date for each job. The dates are spread over days/months/years e.g.
21/10/2007, 04/03/2008. What I need to do is take every job (date) in
every individual month and pull them all in to the 7th of each month.
So, everything in Feb 2007 is now dated 07/02/2007, etc.

Can anyone help with this? (Totally new to VBA).

TIA

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default VBA code for date change? (Newbie)

Unless you have a reason there is no need to resort to VBA. In an adjacent
column type the formula:-

=DATE(YEAR(A1),MONTH(A1),DAY(7))

Drag down as required.

Mike

"DekHog" wrote:

Hi....

I have 33,000 rows with jobs in them - in one of the columns there is
a date for each job. The dates are spread over days/months/years e.g.
21/10/2007, 04/03/2008. What I need to do is take every job (date) in
every individual month and pull them all in to the 7th of each month.
So, everything in Feb 2007 is now dated 07/02/2007, etc.

Can anyone help with this? (Totally new to VBA).

TIA


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default VBA code for date change? (Newbie)

Let's say that column E contains the dates and that you are using dd/mm/yyy
format:

In a helper column enter:

=DATE(YEAR(E1),MONTH(E1),7)

and copy down
--
Gary''s Student - gsnu200726


"DekHog" wrote:

Hi....

I have 33,000 rows with jobs in them - in one of the columns there is
a date for each job. The dates are spread over days/months/years e.g.
21/10/2007, 04/03/2008. What I need to do is take every job (date) in
every individual month and pull them all in to the 7th of each month.
So, everything in Feb 2007 is now dated 07/02/2007, etc.

Can anyone help with this? (Totally new to VBA).

TIA


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default VBA code for date change? (Newbie)

try this
Sub makealldays7()
lr = Cells(Rows.Count, "H").End(xlUp).Row
For Each c In Range("h2:h" & lr)
c.Value = DateSerial(Year(c), Month(c), 7)
Next
End Sub

--
Don Guillett
SalesAid Software

"DekHog" wrote in message
oups.com...
Hi....

I have 33,000 rows with jobs in them - in one of the columns there is
a date for each job. The dates are spread over days/months/years e.g.
21/10/2007, 04/03/2008. What I need to do is take every job (date) in
every individual month and pull them all in to the 7th of each month.
So, everything in Feb 2007 is now dated 07/02/2007, etc.

Can anyone help with this? (Totally new to VBA).

TIA


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA code for date change? (Newbie)

On 3 Jun, 12:56, "Don Guillett" wrote:
try this
Sub makealldays7()
lr = Cells(Rows.Count, "H").End(xlUp).Row
For Each c In Range("h2:h" & lr)
c.Value = DateSerial(Year(c), Month(c), 7)
Next
End Sub

--
Don Guillett
SalesAid Software
"DekHog" wrote in message

oups.com...

Hi....


I have 33,000 rows with jobs in them - in one of the columns there is
a date for each job. The dates are spread over days/months/years e.g.
21/10/2007, 04/03/2008. What I need to do is take every job (date) in
every individual month and pull them all in to the 7th of each month.
So, everything in Feb 2007 is now dated 07/02/2007, etc.


Can anyone help with this? (Totally new to VBA).


TIA


Cheers guys, fantastic - thank you.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie.... need some code... I HOPE! beechum1 Excel Programming 8 January 17th 06 07:47 PM
newbie help - code need correcting haitch2 Excel Programming 5 October 16th 05 06:16 PM
Why this code works and other do not? Newbie here. [email protected] Excel Programming 2 September 10th 05 01:12 PM
VBA Newbie: Help with Do Loop code Carl Excel Discussion (Misc queries) 3 December 2nd 04 07:04 PM
Newbie : How to sum cells via VBA code. Rich[_16_] Excel Programming 5 February 24th 04 02:30 AM


All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"