+ Reply to Thread
Results 1 to 2 of 2

Run macro when cell in range changes due to calculations

  1. #1
    Registered User
    Join Date
    03-07-2013
    Location
    Omaha, NE
    MS-Off Ver
    Excel 2010
    Posts
    4

    Run macro when cell in range changes due to calculations

    I have tried to understand other posts on this subject, but I am VERY new to this and don't understand what I am reading. I have the following macro:

    Sub Hide_Rows_Services()
    Sheets("Services Summary").Select '
    Range("i6:i20").Select
    For Each cell In Selection
    If cell = 0 Then
    Range(cell.Address).EntireRow.Hidden = True
    Else
    Range(cell.Address).EntireRow.Hidden = False
    End If
    Next
    End Sub

    Calculations will change the value in I6:I20. When they do change, I need the above macro to run. I have a similar macro on another worksheet that I want to do the same thing.

    Sub Hide_Rows_GPM()
    Sheets("GPM Summary").Select '
    Range("j21:j99").Select
    For Each cell In Selection
    If cell = 0 Then
    Range(cell.Address).EntireRow.Hidden = True
    Else
    Range(cell.Address).EntireRow.Hidden = False
    End If
    Next
    End Sub

    I need someone to guide me through the steps to make this happen. Please respond as if you are talking to a dummy because on this subject I am. I have not training and I am basically teaching myself as I go. Any help will be appreciated.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Run macro when cell in range changes due to calculations

    Hi, NancykAllen,

    please feel remineded to put Code-Tags around the codes.

    You would need Private Sub Worksheet_Calculate behind the worksheet or monitor the cells which cause the cells to be changed/calculated.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1