LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Loop a specific number of times

Hi,

I have been reading the threads on looping and I can't find an answer to
this: how can I loop a specific number of times? I have a macro that I
repeat daily but on Fridays I need to do the same macro for Fri, Sat, Sun,
and possibly any holidays on Mon. I have a WORKDAY formula that tells me how
many days I need to repeat the process (3 for a normal weekend, 4 if there is
a holiday on Mon).

Here is my current VBA for the weekend that only does 3 days:

Rows("7:11").Select
Selection.Copy
Range("A6:A20").Select
Selection.Insert Shift:=xlDown
'Clears memo#, income, and any messages
Range("B6:B20,M6:M20,P6:P20").Select
Selection.ClearContents
'Changes the color of Saturday to red
Range("G11:I15").Select
Selection.Font.ColorIndex = 3
'Saturday
Selection.FormulaArray = "=TODAY()+1"
Range("G16:I20").Select
'Sunday
Selection.FormulaArray = "=TODAY()+2"
Range("M21").Select
ActiveCell = "Prepared By: " & Application.UserName
Rows("22:22").Select
Selection.Insert Shift:=xlDown
Range("M6").Select

Is there a 'smart' loop that knows how many days to copy the selected
information contained in rows 7:11?

Thanks!
 
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
Why can the number of iterations repeat many times as a loop?? Jorge Luis Excel Discussion (Misc queries) 0 February 1st 08 04:15 PM
Loop Macro a variable number of times thesaxonuk Excel Discussion (Misc queries) 11 October 31st 06 06:05 PM
Count the number of times a cell value is within a specific range Everett Excel Worksheet Functions 4 September 2nd 06 10:54 PM
Count number of times a specific number is displayed in a cell ran subs Excel Worksheet Functions 1 June 27th 05 05:01 PM
Count number of times a specific number is displayed in cells subs[_2_] Excel Programming 1 June 27th 05 03:15 PM


All times are GMT +1. The time now is 08:39 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"