PC Review


Reply
Thread Tools Rate Thread

Display a sequence of cell values based on the week

 
 
Shu of AZ
Guest
Posts: n/a
 
      4th Dec 2008
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 With Quote
 
 
 
 
Hong Quach
Guest
Posts: n/a
 
      5th Dec 2008
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display a sequence of cell values based on the week Shu of AZ Microsoft Excel Misc 0 4th Dec 2008 09:29 PM
how to display week sequence number in Outlook calendar? =?Utf-8?B?WnNvbHQgRHVib3ZhbnN6a3k=?= Microsoft Outlook Calendar 1 25th Aug 2006 03:15 PM
Shortcut key to display change the display from displaying cell values to cell formulae =?Utf-8?B?QUEyZTcyRQ==?= Microsoft Excel Programming 3 14th Sep 2004 12:07 PM
Search/Filter to find values in another range based on two cell values Andy Microsoft Excel Misc 1 30th Apr 2004 12:24 AM
Search/Filter to find values in another range based on two cell values Andy Microsoft Excel Programming 2 29th Apr 2004 04:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:16 PM.