Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2007, 05:57 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Date retrieval

Hi,

I need to populate cells within a WorkSheet cell range with dates from a specified period.

The cells to be populated are in the same column. They must display dates from Monday to Friday ONLY.

[u]For Example:</u>
Mon
Tue
Wed
Thur
Fri
Mon
Tue
Wed
Thu
Fri
Mon
Tue
Wed
Thu
Fri


If the start date required is 1st November, 2006 (a Wednesday), is there a method/facility that I can retrieve the dates to populate these cells within the spreadsheet?

[u]To be displayed as:</u>
Null
Null
01-Nov-06
02-Nov-06
03-Nov-06
06-Nov-06
07-Nov-06
08-Nov-06
09-Nov-06
10-Nov-06
13-Nov-06
14-Nov-06
15-Nov-06
16-Nov-06
17-Nov-06


These dates will continue in the WorkSheet to a specfied date (current or future date).

Thanks in advance,







Neal

A Northern Soul
__________________
Neal

A Northern Soul
 
Old February 1st, 2007, 06:43 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default

I have been given 2 pieces of advice, as follows:

1.
Use a formula to populate the dates.
Assuming 1/11/06 is in B3
copy this =IF(WEEKDAY(B3,2)=5,B3+3,B3+1) into B4 and copy down the column.
From A3 down copy this formula =vlookup(WEEKDAY(B3,2),WeekDays,2,false)
Where Weekdays is a named range with two columns as follows
1 Mon
2 Tue
3 Wed
4 Thu
5 Fri

AND...

2.
If you know the first date then type that into the first cell, in the format you want e.g. 01-Nov

Then right-click on the bottom right hand corner of the cell and drag down as far as you want to go. Then select 'Fill Weekdays'.



Neal

A Northern Soul





Similar Threads
Thread Thread Starter Forum Replies Last Post
For XML data retrieval fancorning4 SQL Server 2000 2 May 18th, 2006 10:33 AM
knowlegde and information retrieval ct Pro PHP 1 April 26th, 2006 12:03 PM
XML Retrieval Help t3projects BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 0 October 11th, 2005 03:24 PM
Data retrieval using MySQL rajanikrishna Beginning PHP 2 November 12th, 2003 11:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.