View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
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