Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
man man is offline
external usenet poster
 
Posts: 1
Default fill weekdays with date

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,393
Default fill weekdays with date

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default fill weekdays with date


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
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
fill series by weekdays in XL 2007 Lisa Hetherington Excel Discussion (Misc queries) 1 November 9th 07 05:54 AM
Date, Weekdays Heckstein Excel Discussion (Misc queries) 3 September 11th 05 10:21 PM
Fill dates with weekdays/workdays only DJ Bjorklund Excel Worksheet Functions 1 January 18th 05 04:48 PM
Auto Fill Weekdays Only Tom Ogilvy Excel Programming 2 June 17th 04 01:31 AM
Auto Fill Weekdays Only Frank Kabel Excel Programming 0 June 16th 04 04:20 PM


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