ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Strange problem with Code (https://www.excelbanter.com/excel-worksheet-functions/111644-strange-problem-code.html)

PH NEWS

Strange problem with Code
 
I have this code on a sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E2:F3003")) Is Nothing Then
Exit Sub
Else
Sheets("Main").Range("G2:M3003").Calculate
Sheets("Main").Range("Q2:Q3003").Calculate
End If
End Sub

The reason I have this code is I have three columns of large array formulae
at the end of my sheet and keeping the book on auto calc is very slow. The
two ranges I am calculating are conditionally formatted to "black out"
depending on the entry of columns E and F. Everything works fine except the
conditional formatting, that is to say the "blacking out" isn't instant. I
have to scroll up and then back down to see the "blacking out" has taken
effect.
Am I missing something, some sort of refresh screen function? I have never
had this problem before. Can anyone help?



PH NEWS

Strange problem with Code
 
Found the answer to this question, thought I post just in case nyone else if
having the same problem.
The screen updating command solves the problem.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E2:F3003")) Is Nothing Then
Exit Sub
Else
Application.ScreenUpdating = True
Sheets("Main").Range("G2:M3003").Calculate
Sheets("Main").Range("Q2:Q3003").Calculate
End If
End Sub
"PH NEWS" wrote in message
...
I have this code on a sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E2:F3003")) Is Nothing Then
Exit Sub
Else
Sheets("Main").Range("G2:M3003").Calculate
Sheets("Main").Range("Q2:Q3003").Calculate
End If
End Sub

The reason I have this code is I have three columns of large array

formulae
at the end of my sheet and keeping the book on auto calc is very slow. The
two ranges I am calculating are conditionally formatted to "black out"
depending on the entry of columns E and F. Everything works fine except

the
conditional formatting, that is to say the "blacking out" isn't instant. I
have to scroll up and then back down to see the "blacking out" has taken
effect.
Am I missing something, some sort of refresh screen function? I have never
had this problem before. Can anyone help?






All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com