LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
TDW TDW is offline
external usenet poster
 
Posts: 18
Default worksheet_Change with Formulas

Hi Mike,

I think you have two issues. First, if I understand the issue correctly, the
cells in column B have formulae referring to another sheet. Consequently,
those cells will never be 'empty'. I think you really want to check if the
cells, i.e. the result of the formula / cell reference, is zero or not a
blank text string, depending on the result of the formula. Second, if those
are formula in column B, then a change in the result of the formula will not
trigger the Worksheet_Change event.

The following is a modification of your code that I think will do the trick
for you.

Private Sub Worksheet_Calculate()
Dim currCell As Range
For Each currCell In Range("B2:B10")
With currCell
Application.EnableEvents = False
'If I understand you correctly, IsEmpty(.Value) will always be
'false as these cells contain formulae. I think you want to
'check if .Text = "" or .Value = 0, depending on the nature
'of the data in the other worksheet.
If .Value = 0 Then
.Offset(0, 4).ClearContents
Else
With .Offset(0, 4)
.Value = "x"
End With
End If
Application.EnableEvents = True
End With
Next currCell
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("A2:A10"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, 5).ClearContents
Else
With .Offset(0, 5)
.Value = "x"
End With
End If
Application.EnableEvents = True
End If
End With
End Sub

--
Timothy White
Contract Programmer
Ontario, Canada

<my initialshite<atsympatico<dot<countryCode



"Mike G - D.C." wrote:

I'm new to this; hopefully someone may be able to help. I have a spreadsheet ...

~~~~~
snip
~~~~~
 
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
Worksheet_change wAyne Excel Programming 2 February 1st 06 06:49 PM
Worksheet_Change ram Excel Programming 8 January 5th 06 11:13 PM
Getting around Worksheet_Change() mtowle Excel Worksheet Functions 1 October 20th 05 06:05 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 04:03 PM.

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"