Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why can the number of iterations repeat many times as a loop?? | Excel Discussion (Misc queries) | |||
Loop Macro a variable number of times | Excel Discussion (Misc queries) | |||
Count the number of times a cell value is within a specific range | Excel Worksheet Functions | |||
Count number of times a specific number is displayed in a cell ran | Excel Worksheet Functions | |||
Count number of times a specific number is displayed in cells | Excel Programming |