Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Convert regular Date to Week Ending or Week Beginning Dates | Excel Discussion (Misc queries) | |||
How do I enter the formula to show the current day of the week ? | Excel Worksheet Functions | |||
Macro to enter week day dates only | Excel Programming | |||
day of the week dates | Excel Worksheet Functions | |||
need to convert list of dates to count no. of dates by week | Excel Worksheet Functions |