Update cell value depending another cell values.

Newbie212

New Member
Joined
Oct 15, 2018
Messages
16
Office Version
  1. 2010
Platform
  1. Windows
Hello Excell masters,
Im trying to achieve the following thing:

I have a macro(button) that pushes information from cell B6 to hidden list in Q collumn, where the curently populated row in the list is selected from a List Box choice. The list box has 10 choices/rows, and the cell link is cell O6, getting values from 1 to 10 depending on the choice.

What im trying to do is get the reverse, - everytime when i press row 5(or any other) on the list box, i need the value of B6 to update to the value of the hidden list on row 5 be it value or "".

I have several variations of this "idea" but i cant get it to work, and im not sure how to isolate it to track changes/calculations only in O6.

VBA Code:
Private Sub Worksheet_Calculate()
If Range("o6").Value = 1 Then
      Range("b6").Value = Range("q1").Value
      
ElseIf Range("o6").Value = 2 Then
      Range("b6").Value = Range("q2").Value
      
ElseIf Range("o6").Value = 3 Then
      Range("b6").Value = Range("q3").Value
      
ElseIf Range("o6").Value = 4 Then
      Range("b6").Value = Range("q4").Value
      
ElseIf Range("o6").Value = 5 Then
      Range("b6").Value = Range("q5").Value
        
End If

End Sub

I will be grateful if someone can help out. Thanks in advance.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I didn't understand your scenario fully. But If you only want to track the changes made in column O then you can try:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Range("O:O")) Is Nothing Then
   'Do your stuff
  End If
End Sub
If you want to track the changes made specifically in O6 then:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Not Intersect(Target, Range("O6")) Is Nothing Then
   'Do your stuff
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,363
Members
449,155
Latest member
ravioli44

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