fill weekdays with date

M

man

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
 
B

Bernard Liengme

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
 
R

royUK

Try thi

Code
-------------------
Option Explici
Dim SourceRange As Rang
Dim FillRange As Rang
Dim StartRange As Rang
Dim ThisCl As Rang
Dim
Dim ThisDate As Dat
Sub FillRangeWeekdays(
Set ThisCl = ActiveCel
g_sFillDirection = "Right
If Not IsDate(ThisCl) The
MsgBox "Enter the first date", vbInformation,
"First day of list"

Else
'fill a range of dates with consecutive date
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 ErrExi
'create a list of dates weekdays only fill to righ
If ThisCl.End(xlToRight).Column < ThisCl.Column + d The
Call MsgBox("There are insufficient Columns for this action",
vbExclamation, "Error"
Exit Su
End I
ThisCl.Offset(0, 1).Value = ThisCl.Value +
Set SourceRange = Range(ThisCl, ThisCl.Offset(0, 1)
Set FillRange = Range(ThisCl, ThisCl.Offset(0, (d - 1))
SourceRange.AutoFill FillRange, xlFillWeekday

FillRange.Columns.AutoFi
ErrExit
End I
Application.ScreenUpdating = Tru
End Su
-------------------

I am adding this function to the calendar form taht is in the Download
section Watch for a newer version soo

--
royU

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top