View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Karen53 Karen53 is offline
external usenet poster
 
Posts: 333
Default Main page Recalculations

Hi,

I"ve noticed that if I change the Worksheet calculation code on one of my
worksheets, it stops.

This is a worksheet calculate where if I change
ShName = Me.Name
to
ShName = CAMMaster.Name
the problem seems to resolve.

Private Sub Worksheet_Calculate()

Dim ShName As String

ShName = Me.Name

Debug.Print "Start Worksheet Calculate " & ShName

Call CurrentStatus.WkSheetCalc(ShName)

End Sub


If I step through the code below and the above code is using Me.Name it
triggers the above code. If the above code is change to CAMMaster.Name, the
below code does not trigger it.

Private Sub Worksheet_Calculate()

Dim CLusedrow As Long
Dim TLusedrow As Long
Dim CAMLICount As Long
Dim TaxLICount As Long

'get the CAM last used row
CLusedrow = LineItemspg.Cells(Rows.Count, "C").End(xlUp).Row
CAMLICount = CLusedrow - 14

'get the Tax last used row
TLusedrow = LineItemspg.Cells(Rows.Count, "H").End(xlUp).Row
TaxLICount = TLusedrow - 14

LineItemspg.Range("M5").Value = CAMLICount
LineItemspg.Range("N5").Value = TaxLICount

End Sub

I was using Me on a lot of the Object modules, so I changed them to be
specific. It doesn't seem Me is as specific as I thought. Would someone be
able to explain to me what and why this is happening?
--
Thanks for your help.
Karen53


"Karen53" wrote:

Hi,

I have a 'Main Page' which contains cells linked to and from various
individual worksheets. I had some trouble with volatile functions. I found
them and removed them. The workbook worked great...Until I performed a file
save as.

Then all Worksheet calculation code for all pages runs everytime a change is
made to 'Main Page', even to an empty cell that is not linked to anything.
If I save the workbook, close it and reopen it, it reverts to working
correctly. Then if I change an unlinked cell nothing happens.

If I make a change to a cell that should trigger the other worksheet
calculates, they run as they should...but they don't stop running. Again, if
I make a change to an empty unlinked cell all the code runs, until I again
save the workbook, close it and reopen it. Then it works correctly again.

Does anyone have any suggestions?
--
Thanks for your help.
Karen53