Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default 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 ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default 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 ?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
code execution has been interrupted del Excel Discussion (Misc queries) 0 September 3rd 05 12:22 PM
Changing query execution sequence winim Excel Discussion (Misc queries) 0 April 1st 05 02:03 AM
Automatic Macro Execution Upon Cell Values Changing Brian Excel Programming 3 November 11th 04 04:30 PM


All times are GMT +1. The time now is 06:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"