Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Screen update won't run...help

I am pretty sure you don't want the sub to execute when Excel opens and
continue until Excel closes. So under what circumstances should it run?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"ToddEZ"
wrote in message
I wrote some code to copy formulas to different cells. I would like the code
to run automatically without having to "run the macro". Below is me code.
Please help.

Sub copyformula()

Application.ScreenUpdating = True

Worksheets("Sheet1").Activate
For Each cell In Range("c1:c1000")
If cell.Value = "Y" Then
cell.Offset(0, 4).Formula = _
cell.Offset(0, 2) + 20

cell.Offset(0, 5).Formula = _
cell.Offset(0, 2) + 26

cell.Offset(0, 6).Formula = _
cell.Offset(0, 2) + 31

End If
Next cell

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Screen update won't run...help

Place the following code in the Sheet1 module ...

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo QuitChanging
If Target.Column = 3 Then
Application.EnableEvents = False
If Target.Cells(1, 1).Value = "Y" Then
Call copyformula
End If
End If
QuitChanging:
Application.EnableEvents = True
End Sub
------------
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html



"ToddEZ"
wrote in message
I would like it to copy over the formulas any time someone types a "Y" in
column C.
thanks for your help.

"Jim Cone" wrote:

I am pretty sure you don't want the sub to execute when Excel opens and
continue until Excel closes. So under what circumstances should it run?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"ToddEZ"
wrote in message
I wrote some code to copy formulas to different cells. I would like the code
to run automatically without having to "run the macro". Below is me code.
Please help.

Sub copyformula()

Application.ScreenUpdating = True

Worksheets("Sheet1").Activate
For Each cell In Range("c1:c1000")
If cell.Value = "Y" Then
cell.Offset(0, 4).Formula = _
cell.Offset(0, 2) + 20

cell.Offset(0, 5).Formula = _
cell.Offset(0, 2) + 26

cell.Offset(0, 6).Formula = _
cell.Offset(0, 2) + 31

End If
Next cell

End Sub


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
SCREEN UPDATE! jay dean Excel Programming 2 October 29th 06 04:38 PM
Screen update? David Excel Programming 1 September 25th 06 05:35 PM
How to update a control without screen flashing Chaplain Doug Excel Programming 4 May 20th 05 07:25 PM
Update cell's value without refresh screen? lantiger Excel Programming 0 May 26th 04 05:23 PM
Screen Update Dilemma Alex@JPCS Excel Programming 0 November 17th 03 06:25 PM


All times are GMT +1. The time now is 06:50 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"