Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that cycles through each cell in a range, eg
for each CELL in RANGE This seems to work OK until I include something in the code that changes the value of CELL, and then the macro just ends at that point. I have tried declaring CELL as a range but no success. Any clues as to why this might happen? Regards, Kaval |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kaval,
Sub TestIt2() Dim rCell As Range Dim rng As Range Set rng = Range("A1:A10") For Each rCell In rng With rCell If IsNumeric(.Value) Then .Value = .Value * 2 End If End With Next rCell End Sub --- Regards, Norman "Kaval" wrote in message ... I have a macro that cycles through each cell in a range, eg for each CELL in RANGE This seems to work OK until I include something in the code that changes the value of CELL, and then the macro just ends at that point. I have tried declaring CELL as a range but no success. Any clues as to why this might happen? Regards, Kaval |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kaval,
Post your problematic code, if necessary. --- Regards, Norman "Kaval" wrote in message ... I have a macro that cycles through each cell in a range, eg for each CELL in RANGE This seems to work OK until I include something in the code that changes the value of CELL, and then the macro just ends at that point. I have tried declaring CELL as a range but no success. Any clues as to why this might happen? Regards, Kaval |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, I since discovered I had a worksheet change event that was running
when I changed the cells and this was ending the code execution. Thanks. "Norman Jones" wrote: Hi Kaval, Sub TestIt2() Dim rCell As Range Dim rng As Range Set rng = Range("A1:A10") For Each rCell In rng With rCell If IsNumeric(.Value) Then .Value = .Value * 2 End If End With Next rCell End Sub --- Regards, Norman "Kaval" wrote in message ... I have a macro that cycles through each cell in a range, eg for each CELL in RANGE This seems to work OK until I include something in the code that changes the value of CELL, and then the macro just ends at that point. I have tried declaring CELL as a range but no success. Any clues as to why this might happen? Regards, Kaval |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, I since discovered I had a worksheet change event that was running
Would this idea help? Sub Demo() Dim Cell As Range '// Don't be interrupted by "Worksheet_Change" Application.EnableEvents = False For Each Cell In [A1:C4] Cell = Rnd Next Application.EnableEvents = True End Sub -- Dana DeLouis Win XP & Office 2003 "Kaval" wrote in message ... Thanks, I since discovered I had a worksheet change event that was running when I changed the cells and this was ending the code execution. Thanks. "Norman Jones" wrote: Hi Kaval, Sub TestIt2() Dim rCell As Range Dim rng As Range Set rng = Range("A1:A10") For Each rCell In rng With rCell If IsNumeric(.Value) Then .Value = .Value * 2 End If End With Next rCell End Sub --- Regards, Norman "Kaval" wrote in message ... I have a macro that cycles through each cell in a range, eg for each CELL in RANGE This seems to work OK until I include something in the code that changes the value of CELL, and then the macro just ends at that point. I have tried declaring CELL as a range but no success. Any clues as to why this might happen? Regards, Kaval |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|