A
andy
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,P620").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!
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,P620").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!