Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your find is going to be an issue if it does not find anything to activate.
You might be able to get away with addin the line On Error Resume Next At the beginning of your code... -- HTH... Jim Thomlinson "xgirl" wrote: 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the tip Jim. After playing around with that idea I was able to
get it to run using the following... On Error GoTo Finished Finished: MsgBox "Complete" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
xpath error? Runtime Error 13 type mismatch | Excel Discussion (Misc queries) | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
naming tab macro error runtime error 1004 | Excel Programming | |||
Interior class error/runtime error 1004 | Excel Programming | |||
Syntax Error Runtime Error '424' Object Required | Excel Programming |