HTH. Best wishes Harald
"Connie Martin" <Connie...@discussions.microsoft.com> wrote in message
news:7A8AFA01-2C11-4AD4...@microsoft.com...
"Connie Martin" <Connie...@discussions.microsoft.com> wrote in message
news:7A8AFA01-2C11-4AD4...@microsoft.com...
=WEEKDAY(a1,2)
Then drag this formula down the column.
Apply Data|filter|autofilter to this helper column
and show the values > 5 (6 and 7 will be the weekends)
Then delete the visible rows
And remove the filter.
================
But maybe even better is to create the list without the weekends.
Put the start date in A1 (say)
Rightclick on the autofill button (the bottom right corner of the selection
indicator.
And drag down
But choose "Fill Weekdays"
There are lots of options you can get when you rightclick and drag on that
autofill button.
Connie Martin wrote:
>
> If I have a column of dates (365 days) from Jan. 1 to Dec. 31, is there a way
> to delete all weekends without the long, manual way of doing it? Connie
--
Dave Peterson
Regards,
Fred
"Connie Martin" <Connie...@discussions.microsoft.com> wrote in message
news:7A8AFA01-2C11-4AD4...@microsoft.com...
"Harald Staff" wrote:
> .
>
"David Biddulph" wrote:
> .
>
"Dave Peterson" wrote:
> .
>
"Fred Smith" wrote:
> .
>
Sub DeleteWeekends()
Dim WS As Worksheet
Dim RowNdx As Long
Dim TestCol As String
Dim LastRow As Long
Dim StopRow As Long
TestCol = "B" '<<< Column to test dates
StopRow = 3 '<<< Row number to stop at moving upwards
Set WS = Worksheets("Sheet1") '<<< Which worksheet.
With WS
LastRow = .Cells(.Rows.Count, _
TestCol).End(xlUp).Row
End With
For RowNdx = LastRow To StopRow Step -1
If Weekday(WS.Cells(RowNdx, TestCol).Value, _
vbMonday) >= 6 Then
WS.Rows(RowNdx).Delete
End If
Next RowNdx
End Sub
If you want to create a new list of dates that exclude weekends, enter
the starting data in some cell, say A1. Then, in A2, enter
=WORKDAY(A1,1)
and copy this formula down for as many rows as you need. If you are
using Excel 2003 or earlier, you'll need to load the Anlaysis Tool
Pack. Go to the Tools menu, choose Add-Ins, and put a check next to
"Analysis Tool Pak". This step is not necessary in Excel 2007 and
later.
Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]