PC Review


Reply
Thread Tools Rate Thread

Changing cell value in a range terminates code execution

 
 
=?Utf-8?B?QW5keQ==?=
Guest
Posts: n/a
 
      31st Oct 2006
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 With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      31st Oct 2006
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


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 Microsoft Excel Misc 0 29th Jun 2009 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 Microsoft Excel Misc 0 26th Jun 2009 06:01 PM
Slow execution changing cell value Nate Microsoft Excel Programming 4 27th Feb 2009 01:17 AM
Automatic Macro Execution Upon Cell Values Changing =?Utf-8?B?QnJpYW4=?= Microsoft Excel Programming 3 11th Nov 2004 04:30 PM
code runs well on 3rd execution after getting Error: 3021 on 1st 2 execution =?Utf-8?B?eWFubg==?= Microsoft Access VBA Modules 0 23rd Mar 2004 10:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:13 PM.