Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Is there a way to change all dates in a spread sheet

I have a spread sheet with dates for the whole year of 2006. Exmaple I have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I changed
the dates to the right dates of 2007 without gong to each block of dates.
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default Is there a way to change all dates in a spread sheet

Excel stores the dates as 1/1/2006, so it won't find any instances of "/06"
to change. "\2006" and "/2007" do work.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Don Guillett" wrote in message
...
or maybe
replace
/06
/07

--
Don Guillett
SalesAid Software

"delete automatically"
wrote in message
...
I have a spread sheet with dates for the whole year of 2006. Exmaple I
have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I
changed
the dates to the right dates of 2007 without gong to each block of dates.





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Is there a way to change all dates in a spread sheet

Try

Sub NextYear()
intRows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To intRows
oldDate = ActiveSheet.Cells(i, 1).Value
If IsDate(oldDate) Then
newDate = DateAdd("yyyy", 1, oldDate)
ActiveSheet.Cells(i, 1).Value = newDate
End If
Next
End Sub

* will not account for leap years.
--
Eric Travers


"delete automatically" wrote:

I have a spread sheet with dates for the whole year of 2006. Exmaple I have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I changed
the dates to the right dates of 2007 without gong to each block of dates.



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default Is there a way to change all dates in a spread sheet

Yeah, I guess you can use a macro to automate a simple find & replace.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Don Guillett" wrote in message
...
or using what Jon posted

Sub Macro13()'recorded
'
' Macro13 Macro
' Macro recorded 12/22/2006 by Don Guillett
'

'
Cells.Replace what:="/2006", Replacement:="/2007", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


--
Don Guillett
SalesAid Software

"TraversE" wrote in message
...
Try

Sub NextYear()
intRows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To intRows
oldDate = ActiveSheet.Cells(i, 1).Value
If IsDate(oldDate) Then
newDate = DateAdd("yyyy", 1, oldDate)
ActiveSheet.Cells(i, 1).Value = newDate
End If
Next
End Sub

* will not account for leap years.
--
Eric Travers


"delete automatically" wrote:

I have a spread sheet with dates for the whole year of 2006. Exmaple I
have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have
other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I
changed
the dates to the right dates of 2007 without gong to each block of
dates.





  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Is there a way to change all dates in a spread sheet

Jon, I agree. Remember at the start of the thread I recommended replace.

--
Don Guillett
SalesAid Software

"Jon Peltier" wrote in message
...
Yeah, I guess you can use a macro to automate a simple find & replace.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Don Guillett" wrote in message
...
or using what Jon posted

Sub Macro13()'recorded
'
' Macro13 Macro
' Macro recorded 12/22/2006 by Don Guillett
'

'
Cells.Replace what:="/2006", Replacement:="/2007", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


--
Don Guillett
SalesAid Software

"TraversE" wrote in message
...
Try

Sub NextYear()
intRows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To intRows
oldDate = ActiveSheet.Cells(i, 1).Value
If IsDate(oldDate) Then
newDate = DateAdd("yyyy", 1, oldDate)
ActiveSheet.Cells(i, 1).Value = newDate
End If
Next
End Sub

* will not account for leap years.
--
Eric Travers


"delete automatically" wrote:

I have a spread sheet with dates for the whole year of 2006. Exmaple I
have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have
other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I
changed
the dates to the right dates of 2007 without gong to each block of
dates.







  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default Is there a way to change all dates in a spread sheet

I remember, so I was surprised you bothered with a VBA approach. Not that
there's anything wrong with that.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Don Guillett" wrote in message
...
Jon, I agree. Remember at the start of the thread I recommended replace.

--
Don Guillett
SalesAid Software

"Jon Peltier" wrote in message
...
Yeah, I guess you can use a macro to automate a simple find & replace.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Don Guillett" wrote in message
...
or using what Jon posted

Sub Macro13()'recorded
'
' Macro13 Macro
' Macro recorded 12/22/2006 by Don Guillett
'

'
Cells.Replace what:="/2006", Replacement:="/2007", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


--
Don Guillett
SalesAid Software

"TraversE" wrote in message
...
Try

Sub NextYear()
intRows = ActiveSheet.UsedRange.Rows.Count
For i = 1 To intRows
oldDate = ActiveSheet.Cells(i, 1).Value
If IsDate(oldDate) Then
newDate = DateAdd("yyyy", 1, oldDate)
ActiveSheet.Cells(i, 1).Value = newDate
End If
Next
End Sub

* will not account for leap years.
--
Eric Travers


"delete automatically" wrote:

I have a spread sheet with dates for the whole year of 2006. Exmaple I
have
1/1/06 thru 1/15/06 in the first 14 rows. Then rows 15 thru 20 have
other
data. Then start with 1/16/06 thru 1/29/06 then more data. How can I
changed
the dates to the right dates of 2007 without gong to each block of
dates.








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
Summary sheet showing holiday dates taken louiscourtney Excel Worksheet Functions 4 December 19th 06 03:04 PM
Want cell ref. to change after sort in other sheet Bullfn33 Excel Discussion (Misc queries) 1 August 6th 06 05:48 PM
Macro to change data in a sheet Diana Excel Discussion (Misc queries) 1 April 28th 06 08:01 PM
Change scales from reference cells value for a chart in a separate sheet ers Charts and Charting in Excel 4 April 2nd 06 07:00 PM
when i move or copy a sheet, dates change by one day?? Devo Excel Discussion (Misc queries) 2 February 5th 06 03:01 PM


All times are GMT +1. The time now is 09:34 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"