Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default VB code for autofill

This will be easy for a VB coder: I have a row range E1:DV1 with concurrent
dates starting Aug 2010 to Nov 2010. I want the rows (lets say 20) below
weekends to be autofilled (Result: Weekends will be visible as columns)
without being affected by subsequent conditional formatting or VB code. The
subsequent code or conditional formatting must autofill between date ranges
obtained from corresponding cells in columns C&D.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default VB code for autofill

Lets see if I fully understand your question.
You have a row of dates (1st Aug 2010 to 30th Nov 2010) in cells E1:DV1.
You have a start date in column C
You have an end date in column D
You want all weekend dates filled in for all the columns.
You want the weekday dates filled in for the period between the start and end.

If above is correct then it can be done with a fomula without using VBA.

Assume that C2 contains a start date and D2 an end date.
Enter the following formula in E2.

=IF(AND(E$1=$C2,E$1<=$D2,WEEKDAY(E$1,2)<6),E$1,IF (WEEKDAY(E$1,2)5,E$1,""))

Note: Although the formula may appear as 2 lines in the post, it is actually
one line so you will have to fix that up when you copy it into the formular
bar.

You should be able to copy the formula across all columns and down as far as
you want.

Entering or changing values in columns C and D should produce the results
you desire.

Note: If both C and D are blank or only C contains a date, only the weekends
will be populated. If only column D contains a date and C is blank, then all
columns will be populated.

--
Regards,

OssieMac


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
Autofill data based on an assigned code/prefix anrcreations Excel Worksheet Functions 2 February 11th 10 07:50 PM
How to Autofill HTML code into Excell spreadsheet Lisa Excel Programming 3 June 28th 07 08:03 PM
Autofill cells in 1 column :code ?? Luc Excel Programming 2 February 26th 07 10:33 PM
AutoFill Formula with code Desert Piranha[_46_] Excel Programming 11 February 7th 06 05:46 AM
VBA code to Autofill one cell to many rows below where row count will change TrainingGoddess Excel Programming 5 March 28th 05 03:53 AM


All times are GMT +1. The time now is 04:53 AM.

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

About Us

"It's about Microsoft Excel"