| Member with 5,164 posts. | | Join Date: Jul 2004 Location: Oregon, United States Experience: I'ma learnin'! | |
Ok, well this should get you what you need. Please read the comments in the code... Code: Sub UpdateDates()
Dim WB1 As Workbook
Dim WB2 As Workbook
Dim WS1 As Worksheet
Dim WS2 As Worksheet
Dim rYear As Range
Dim rDates As Range
Dim rCell As Range
'/// This ASSUMES you will already have the files open.
'/// If you will NOT have the files open, we need more code.
Set WB1 = Workbooks("Excel File's Name Here")
Set WB2 = Workbooks("CSV File's Name Here")
Set WS1 = WB1.Worksheets("Worksheet Name Here")
Set WS2 = WB1.Worksheets("Worksheet Name Here")
'/// Year cell gets set here
Set rYear = WS1.Range("A1").Value
'/// Dates to get changed is set here
Set rDates = WS2.Range("A1:A12")
'/// Perform the action
For Each rCell In rDates.Cells
rCell.Value = DateSerial(rYear.Value, Month(rCell.Value), Day(rCell.Value))
Next rCell
End Sub HTH |