View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wouter HM Wouter HM is offline
external usenet poster
 
Posts: 99
Default VB code for column fill matching weekends

On 15 mei, 12:24, Kobus wrote:
This will be easy for a VB coder: I have a row with calender dates across
about 100 days (cells E:DV). *I want the colums representing weekends to be
autofilled and remain unaffected by subsequent conditional formatting (or vb
code). Then (this is the subsequent part) rows below must be filled between
date ranges obtained from cells from columns, say C and D. *Columns C being a
start date and D an end date. Note I have used the WORKDAY FUNCTION to
identify weekends through numbers 1 - 7, if that would help)


Hi Kobus,

Assuming you have the startdate in cell C2 and the enddate in cell D2

You can solve this with conditional formatting only.
For marking the weekends use the WEEKDAY function
=WEEKDAY(E$1,2)5
For marking the days from your startdate unto and including the
enddate add a second rule and use
=AND(E$1=$C$2,E$1<=$D$2)
Use the brush to copy these conditiond from column E to the right.


HTH,

Wouter