G
Guest
Hello, I realize this may not be the best code in the world but it works
till the end when I get a runtime error.
I have a column of a series of 1's and 0's - as in 20 consecutive 1's
followed by 100 consecutive 0's followed by 40 consecutive 1's etc. I want
the macro to locate the last 1 (or first 0) in the series and then run a
macro. My macro works until it gets to the last set of 0's and can't find a
1. Any help greatly appreciated!
Sub FillLowTotal()
Application.ScreenUpdating = False
Range("e5").Select
Do
Do Until ActiveCell = 0
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
ActiveCell.Select
ActiveSheet.Application.Run ("Lowtotal")
Range(Selection, Selection.End(xlDown)).Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=False).Activate
Loop Until IsEmpty(ActiveCell.Value)
End Sub
till the end when I get a runtime error.
I have a column of a series of 1's and 0's - as in 20 consecutive 1's
followed by 100 consecutive 0's followed by 40 consecutive 1's etc. I want
the macro to locate the last 1 (or first 0) in the series and then run a
macro. My macro works until it gets to the last set of 0's and can't find a
1. Any help greatly appreciated!
Sub FillLowTotal()
Application.ScreenUpdating = False
Range("e5").Select
Do
Do Until ActiveCell = 0
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
ActiveCell.Select
ActiveSheet.Application.Run ("Lowtotal")
Range(Selection, Selection.End(xlDown)).Select
Selection.Find(What:="1", After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:=False).Activate
Loop Until IsEmpty(ActiveCell.Value)
End Sub