Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
now i need to fill across columns. for example, today be wednesday, me
needs this week and two weeks of data like this: wed thu fri mon tue wed thu fri mon tue wed thu fri on monday i need this with dates mon tue wed thu fri mon tue wed thu fri u get the idea, now pls post code to fill across with dates |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Enter the starting date in some cell (In the example, I will use A1)
If you want the current date use =TODAY() In B1 type =WORKDAY(A1,1) Copy this across the row to M1 Later you can use Help to lean how to add a list of holidays to the worksheet and have you formula skip any holiday -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "man" wrote in message ... now i need to fill across columns. for example, today be wednesday, me needs this week and two weeks of data like this: wed thu fri mon tue wed thu fri mon tue wed thu fri on monday i need this with dates mon tue wed thu fri mon tue wed thu fri u get the idea, now pls post code to fill across with dates |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Try this Code: -------------------- Option Explicit Dim SourceRange As Range Dim FillRange As Range Dim StartRange As Range Dim ThisCl As Range Dim d Dim ThisDate As Date Sub FillRangeWeekdays() Set ThisCl = ActiveCell g_sFillDirection = "Right" If Not IsDate(ThisCl) Then MsgBox "Enter the first date", vbInformation, _ "First day of list" Else: 'fill a range of dates with consecutive dates d = InputBox("How many days do you want to add" & vbNewLine & vbNewLine _ & "Weekends will not be included") If d = 0 Or d < 0 Or d = vbNullString Then GoTo ErrExit 'create a list of dates weekdays only fill to right If ThisCl.End(xlToRight).Column < ThisCl.Column + d Then Call MsgBox("There are insufficient Columns for this action", _ vbExclamation, "Error") Exit Sub End If ThisCl.Offset(0, 1).Value = ThisCl.Value + 1 Set SourceRange = Range(ThisCl, ThisCl.Offset(0, 1)) Set FillRange = Range(ThisCl, ThisCl.Offset(0, (d - 1))) SourceRange.AutoFill FillRange, xlFillWeekdays FillRange.Columns.AutoFit ErrExit: End If Application.ScreenUpdating = True End Sub -------------------- I am adding this function to the calendar form taht is in the Downloads section Watch for a newer version soon -- royUK Hope that helps, RoyUK For tips & examples visit my 'web site ' (http://www.excel-it.com) ------------------------------------------------------------------------ royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=31453 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
fill series by weekdays in XL 2007 | Excel Discussion (Misc queries) | |||
Date, Weekdays | Excel Discussion (Misc queries) | |||
Fill dates with weekdays/workdays only | Excel Worksheet Functions | |||
Auto Fill Weekdays Only | Excel Programming | |||
Auto Fill Weekdays Only | Excel Programming |