Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Display a sequence of cell values based on the week

This question is also in General Questions with no response yet.

I have a block of cells with data; A1:L38. There are 169 sequences or types
of these blocks possible. Each individual block coorelates to a week from
Sunday to Monday. Ex. sequence id 43 coorelates to the week of Dec 1 at
00:01 in the morning which is Monday to Sunday the 7th at 11:59 pm. This is
not literally true as the first week I roll this out will actually be
sequence id 1 and so on. If I rolled this out today, next week would be
sequence 2.

So I have 169 weeks of different combinations of these cells contained
within A1:L38.

How can I auto fill a sheet ("Data") with the correct block for the week
that is current when you open the worksheet. Any ideas? Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Display a sequence of cell values based on the week

Hi Shu,

This is one of the method that I think will solve your problem of getting
the correct sequence number that corresponds to a particular week.

'START_DATETIME is the date time of the 1st instance
'This must stay fix for the entire 169 weeks or more
'to produce the same sequence.
'Notice the week date of the choosen date will be use
'to calculate in the DateDiff().
'12-01-2008 00:00:00 is the beginning of Monday.
Const START_DATETIME = "12-01-2008 00:00:00"

Public Sub SetDataBlock()
Dim rg As Range
Dim CurrSeq As Integer

Set rg = Range("A1:L38")

'Find the sequence number
'(+1 is to shift away from 0 and Mod function)
CurrSeq = ((DateDiff("ww", START_DATETIME, Now())) Mod 169) + 1

'Fill the Data with the corresponding sequence
rg = CurrSeq
End Sub

Hong Quach

"Shu of AZ" wrote:

This question is also in General Questions with no response yet.

I have a block of cells with data; A1:L38. There are 169 sequences or types
of these blocks possible. Each individual block coorelates to a week from
Sunday to Monday. Ex. sequence id 43 coorelates to the week of Dec 1 at
00:01 in the morning which is Monday to Sunday the 7th at 11:59 pm. This is
not literally true as the first week I roll this out will actually be
sequence id 1 and so on. If I rolled this out today, next week would be
sequence 2.

So I have 169 weeks of different combinations of these cells contained
within A1:L38.

How can I auto fill a sheet ("Data") with the correct block for the week
that is current when you open the worksheet. Any ideas? Thanks in advance.

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
Display columns or rows based on values bmac Excel Discussion (Misc queries) 1 March 20th 10 02:56 PM
Lookup and Display Multiple Unique values based on criteria MPI Planner[_2_] Excel Worksheet Functions 2 December 11th 09 03:06 PM
Display a sequence of cell values based on the week Shu of AZ Excel Discussion (Misc queries) 0 December 4th 08 09:29 PM
Excel 2007 Display value based on values in another column range ChrisM Excel Worksheet Functions 2 September 4th 06 03:32 PM
Shortcut key to display change the display from displaying cell values to cell formulae Adrian[_7_] Excel Programming 3 September 14th 04 12:07 PM


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