Hi,
i have a bunch of dates in column B that are populated from an external feed into excel. the dates are populated starting at cell B5 and going down X number of rows...X because the dates could go down 5 rows or 50 depending on what the external feed populates into excel, but never over 200
here is my code
when i change a cell in the sheet it seems like it just keeps running the macro, i have to force it to shut down by pressing the Esc key....
this usually ends up with excel crashing
any input would be appreciated
thanks
i have a bunch of dates in column B that are populated from an external feed into excel. the dates are populated starting at cell B5 and going down X number of rows...X because the dates could go down 5 rows or 50 depending on what the external feed populates into excel, but never over 200
here is my code
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RowCount As Double
RowCount = Application.WorksheetFunction.CountA(Range("B5:B200"))
Dim Counter As Double
Counter = 0
Do Until Counter = RowCount
If Weekday(Range("B5").Offset(Counter, 0)) = 1 Then Range("B5").Offset(Counter, 3) = Range("B5").Offset(Counter, 0) + 1
If Weekday(Range("B5").Offset(Counter, 0)) = 7 Then Range("B5").Offset(Counter, 3) = Range("B5").Offset(Counter, 0) + 2
If Weekday(Range("B5").Offset(Counter, 0)) > 1 And Weekday(Range("B5").Offset(Counter, 0)) < 7 Then Range("B5").Offset(Counter, 3) = Range("B5").Offset(Counter, 0)
Counter = Counter + 1
Loop
End Sub
this usually ends up with excel crashing
any input would be appreciated
thanks