• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA update when target value changes from a formula

ncsmith

New Member
Hi All,

I have been trying to find a solution to this problem for over a week.

I have a file with 2 combo boxes, which update the values in a forecast table. The amount of rows in the forecast table will vary depending on the selection of the comboboxes.

I have the below code that hides the unneeded rows with no data using the value in cell A1 whichc derives from a formula, however this vba only activates if i manually change the value of A1 and not when it changes from the result of the formula updating.

I have tried to adapt and change this but nothing works.

>>> try to use code - tags ... those works <<<
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Target.Address = "$A$1" Then
      Rows("8:13").Hidden = False
      If Target.Value > 0 And Target.Value < 5 Then
         Rows(Target.Value + 8 & ":13").Hidden = True
      End If
   End If
End Sub
I am hoping someone can help me solve this problem.

Thanks
NcS
 

Attachments

  • Example book.xlsm
    26.4 KB · Views: 1
Last edited by a moderator:
Hi,​
first according to this forum rules, you must use code tags via the icon in the 3 dots menu, thanks to edit your post !​
As there is no event for 'values changed from a formula' the reason why another event must be used like SelectionChange …​
 
Back
Top