Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to enter week day dates only

I use XL2003

Each month I. have to enter dates for expenses etc into xl sheets.

I only require week dates ie never saturdays or sundays

I copy the previous months sheets rename to current month and use the
follwing macro I have to delete the old dates enter the dates for the new
month in th A column. Utilising Xls built in calender input box thingy.

At present .I then have to look up the saturdays and sundays in my dairy &
delete them then move up those days to remove the gaps manually pasting. I
have do do this to leave the table box s at the A column in place at the
table bottom.

I have tried to write and/or record a macro using the =weekday() function to
do this but it fails to work.

Any Ideas:

This macro enters all the days.

Sub EnterExpDates()
'
' EnterExpDates Macro
' Macro recorded 04/11/2007 by Jim Horslett
'

'
Range("A7").Select
Selection.AutoFill Destination:=Range("A7:A38"), Type:=xlFillDefault
Range("A7:A38").Select
Selection.ClearContents
Range("A6").Select
ActiveCell.Offset(1, 0).Select
Application.Run "PERSONAL.XLS!OpenCalendar"
Range("A7").Select
Selection.AutoFill Destination:=Range("A7:A38"), Type:=xlFillDefault
Range("A7:A38").Select

End Sub








  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macro to enter week day dates only

hi,
since your macro is grabbing something out of personal.xls i'm not sure how
to handle just adding weekdays. but once you have the month's date in you can
add this to the end to go back and delete the saturdays and sundays.
Dim r As Range
Dim rd As Range
Set r = Range("A1")
Do While Not IsEmpty(r)
Set rd = r.Offset(1, 0)
If Weekday(r) = 1 Or Weekday(r) = 7 Then
'1 = sunday, 2 = monday, 3 = tuesday, ect
r.EntireRow.Delete shift:=xlUp
End If
Set r = rd
Loop
end sub'?
adjust to fit your data.
Probably not the best workaround but i'm not sure how you are adding your
dates

regards
FSt1
"Jimbo Slim" wrote:

I use XL2003

Each month I. have to enter dates for expenses etc into xl sheets.

I only require week dates ie never saturdays or sundays

I copy the previous months sheets rename to current month and use the
follwing macro I have to delete the old dates enter the dates for the new
month in th A column. Utilising Xls built in calender input box thingy.

At present .I then have to look up the saturdays and sundays in my dairy &
delete them then move up those days to remove the gaps manually pasting. I
have do do this to leave the table box s at the A column in place at the
table bottom.

I have tried to write and/or record a macro using the =weekday() function to
do this but it fails to work.

Any Ideas:

This macro enters all the days.

Sub EnterExpDates()
'
' EnterExpDates Macro
' Macro recorded 04/11/2007 by Jim Horslett
'

'
Range("A7").Select
Selection.AutoFill Destination:=Range("A7:A38"), Type:=xlFillDefault
Range("A7:A38").Select
Selection.ClearContents
Range("A6").Select
ActiveCell.Offset(1, 0).Select
Application.Run "PERSONAL.XLS!OpenCalendar"
Range("A7").Select
Selection.AutoFill Destination:=Range("A7:A38"), Type:=xlFillDefault
Range("A7:A38").Select

End Sub









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
Convert regular Date to Week Ending or Week Beginning Dates Sam H Excel Discussion (Misc queries) 5 April 3rd 23 04:39 PM
How do I enter the formula to show the current day of the week ? Simple, but I don't know Excel Worksheet Functions 4 May 19th 08 10:17 PM
Macro to enter week day dates only Jimbo Slim Excel Programming 4 November 15th 07 11:38 PM
day of the week dates JK (New England Coffee) Excel Worksheet Functions 2 April 25th 06 04:27 PM
need to convert list of dates to count no. of dates by week neowok Excel Worksheet Functions 13 January 30th 06 03:54 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"