Worksheet_Change by calculated value?

austin350s10

Active Member
Joined
Jul 30, 2010
Messages
321
I am working on a sheet that needs to run a script when specified range changes it's calculated value.

I tried using the Worksheet_Change event but the problem is that the range I am monitoring contains only calculated values not real values. When the script I have now runs it sees that the cells in the range have not changed because it is looking at the formula in the cell. Is there a way to check the calculated value instead of the formula?


Code Now:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Range1 As Range
Set Range1 = Range("A3:A10")
If Not Intersect(Target, Range1) Is Nothing Then
For Each wks In ThisWorkbook.Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))
            wks.Visible = xlSheetVeryHidden
        Next wks
For Each c In Range1
Dim L1 As String
    If c <> "- Pick Log Sheet -" Then
        For Each wks In ThisWorkbook.Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))
            L1 = wks.Name
                If c = L1 Then
                    wks.Visible = xlSheetVisible
                End If
        Next wks
    End If
Next c
End If
End Sub
 
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Range6 As Range
Set Range6 = Range("LogA, LogB, LogC, LogD, LogE, LogF, LogG, LogI")
If Not Intersect(Target, Range6) Is Nothing Then
Dim wks As Sheets
Dim c As Range
For Each wks In ThisWorkbook.Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))
            wks.Visible = xlSheetVeryHidden
        Next wks
For Each c In Range6
Dim L1 As String
    If c <> "- Pick Log Sheet -" Then
        For Each wks In ThisWorkbook.Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))
            L1 = wks.Name
                If c = L1 Then
                    wks.Visible = xlSheetVisible
                End If
        Next wks
    End If
Next c
End If
End Sub
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I tried:

Code:
For Each wks In ThisWorkbook.Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))

And
Code:
For Each wks In Worksheets(Array("Blood Sugar Log", "Blood Pressure Log", "Respiration Log", "Pulse Log", "Weight Log", "Temperature Log", "Medication Log", "Blood Sugar Log", "Blood Sugar Log Plus"))

Both with the same result. Stopping at wks.name

I don't know to qualify worksheets though. That's a bit over my head.
 
Upvote 0
If your workbook is named Book1.xls:

Code:
Sub Test()
    Dim wks As Worksheet
    For Each wks In Workbooks("Book1.xls").Worksheets(Array("Blood Sugar Log", "Blood Pressure Log"))
        MsgBox wks.Name
    Next wks
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top