![]() |
Changing cell value in a range terminates code execution
I tried two different ways of changing cell values and attributes as follows:
1) For Rw = 4 To 12 For Cm = 2 To 10 Cells(Rw, Cm).Value = 0 Cells(Rw, Cm).Font.Size = 24 Cells(Rw, Cm).Font.ColorIndex = 1 Next Cm Next Rw 2) For Each c In Worksheets("Sheet1").Range("B4:J12") c.Value = 0 c.Font.Size = 24 c.Font.ColorIndex = 1 Next c Both are straight out of Excel VB help. Execution of both terminate immediately after the value of the first cell is changed, with no error message. If I comment out the .value statements, they both run fine. Cells formatted as Number. Has anybody run into this before ? What am I missing ? |
Changing cell value in a range terminates code execution
Hi
Works for me. Are you in break mode in the editor maybe or something like that? Try Run, Reset and Debug, Clear Breakpoints. regards Paul Andy wrote: I tried two different ways of changing cell values and attributes as follows: 1) For Rw = 4 To 12 For Cm = 2 To 10 Cells(Rw, Cm).Value = 0 Cells(Rw, Cm).Font.Size = 24 Cells(Rw, Cm).Font.ColorIndex = 1 Next Cm Next Rw 2) For Each c In Worksheets("Sheet1").Range("B4:J12") c.Value = 0 c.Font.Size = 24 c.Font.ColorIndex = 1 Next c Both are straight out of Excel VB help. Execution of both terminate immediately after the value of the first cell is changed, with no error message. If I comment out the .value statements, they both run fine. Cells formatted as Number. Has anybody run into this before ? What am I missing ? |
All times are GMT +1. The time now is 10:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com