TRIGGER A MACRO WHEN CELL VALUE HAS CHANGED

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like for a macro to trigger when a cell value has changed. This is exactly what I want to do, could you possibly give me the code accomplish it

When J36 is "something other than blank" zoom to 75%

I know it sounds silly but, we're dealing with a monitor being far away and need to utilize the zoom in a macro. Your help is appreciated.
 
right click on the worksheet tab where you want this to occur. Select view code
and paste this in:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("J36")) Is Nothing Then Exit Sub

If IsEmpty(Target) Then
ActiveWindow.Zoom = 100
Else
ActiveWindow.Zoom = 75
End If

End Sub

then try it out.
 
Thank you Dave. Ofcourse it worked as I had hoped!

As you may be able to tell I am more of a novice / intermediate when it comes to Excel so my question is, what is the difference between a macro and what you suggested I do in the "View Code" section of the worksheet

Your help is greatly appreciated.
 
Back
Top