Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Update Date Cell

Hi All,

I have the following macro in excel.

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
arrData(0) = Range("A35")
For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

This to to rotate names through a 17 week shift rosta when macro is run.

What I need is I have a week commencing date in cell A10, e.g. 04 May 2009
is there a code I can add so that when the shift rotates when I run the macro
the date in Cell A10 can be replaced by the new week commencing date e.g. 11
May 2009
and so on when the macro is run.

Any help is greatfully appreciated.

Many thanks

Terilad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Update Date Cell

Try the below. Note the new line added to increment the date. Range("A10") =
Range("A10") + 7

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant

Range("A10") = Range("A10") + 7
arrData(0) = Range("A35")

For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"terilad" wrote:

Hi All,

I have the following macro in excel.

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
arrData(0) = Range("A35")
For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

This to to rotate names through a 17 week shift rosta when macro is run.

What I need is I have a week commencing date in cell A10, e.g. 04 May 2009
is there a code I can add so that when the shift rotates when I run the macro
the date in Cell A10 can be replaced by the new week commencing date e.g. 11
May 2009
and so on when the macro is run.

Any help is greatfully appreciated.

Many thanks

Terilad

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Update Date Cell

Your a genius.

Many thanks

Terilad

"Jacob Skaria" wrote:

Try the below. Note the new line added to increment the date. Range("A10") =
Range("A10") + 7

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant

Range("A10") = Range("A10") + 7
arrData(0) = Range("A35")

For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"terilad" wrote:

Hi All,

I have the following macro in excel.

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
arrData(0) = Range("A35")
For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

This to to rotate names through a 17 week shift rosta when macro is run.

What I need is I have a week commencing date in cell A10, e.g. 04 May 2009
is there a code I can add so that when the shift rotates when I run the macro
the date in Cell A10 can be replaced by the new week commencing date e.g. 11
May 2009
and so on when the macro is run.

Any help is greatfully appreciated.

Many thanks

Terilad

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Update Date Cell

Thanks for the feedback..
--
If this post helps click Yes
---------------
Jacob Skaria


"terilad" wrote:

Your a genius.

Many thanks

Terilad

"Jacob Skaria" wrote:

Try the below. Note the new line added to increment the date. Range("A10") =
Range("A10") + 7

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant

Range("A10") = Range("A10") + 7
arrData(0) = Range("A35")

For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"terilad" wrote:

Hi All,

I have the following macro in excel.

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
arrData(0) = Range("A35")
For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

This to to rotate names through a 17 week shift rosta when macro is run.

What I need is I have a week commencing date in cell A10, e.g. 04 May 2009
is there a code I can add so that when the shift rotates when I run the macro
the date in Cell A10 can be replaced by the new week commencing date e.g. 11
May 2009
and so on when the macro is run.

Any help is greatfully appreciated.

Many thanks

Terilad

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Update Date Cell

Hi Jacob,

Sorry to pester you but I have noticed another range of cells which require
to go forward 7 days, the code you gave me works fine for the week commencing
cell, the other cells are Days of week cells displayed as Manday 04 and so
on. I have moved the week comm cell data to cell N2, the other 7 cells which
require to go forward 7 days a D4,F4,H4,J4,L4,N4 and P4 these cells hold
days of week with date, displayed like Monday 04, Tuesday 05 and so on.

Can you give me any help on this.

Regards

Terilad

"Jacob Skaria" wrote:

Try the below. Note the new line added to increment the date. Range("A10") =
Range("A10") + 7

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant

Range("A10") = Range("A10") + 7
arrData(0) = Range("A35")

For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"terilad" wrote:

Hi All,

I have the following macro in excel.

Sub Macro()
Dim lngRow As Long
Dim intTemp As Integer
Dim arrData(17) As Variant
arrData(0) = Range("A35")
For lngRow = 3 To 35 Step 2
intTemp = intTemp + 1
arrData(intTemp) = Range("A" & lngRow)
Range("A" & lngRow) = arrData(intTemp - 1)
Next
Range("A1") = varValue
End Sub

This to to rotate names through a 17 week shift rosta when macro is run.

What I need is I have a week commencing date in cell A10, e.g. 04 May 2009
is there a code I can add so that when the shift rotates when I run the macro
the date in Cell A10 can be replaced by the new week commencing date e.g. 11
May 2009
and so on when the macro is run.

Any help is greatfully appreciated.

Many thanks

Terilad

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
Update a date into the same cell? Greg L[_2_] Excel Worksheet Functions 11 June 29th 09 02:24 AM
Automatically update a cell with a date based on anther cells date GPR GUY Excel Discussion (Misc queries) 2 November 3rd 08 03:57 PM
input a date or update it based on date in another cell Doug P New Users to Excel 1 July 18th 07 11:25 PM
Populating Last Saved Date in Cell AND also update that same cell in Header o0o_Bigs_o0o Excel Discussion (Misc queries) 2 July 4th 06 12:56 PM
How to update a cell if a specific date is included in a date rang mgavidia Setting up and Configuration of Excel 2 October 8th 05 12:53 AM


All times are GMT +1. The time now is 11:54 AM.

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

About Us

"It's about Microsoft Excel"