Automatically update cell.value as long as a ActiveX checkbox is checked - excel 365 on WINDOWS

excel_lelkes

New Member
Joined
May 16, 2017
Messages
30
C2.value is updated when a button is clicked.
My wish is that so long cbox1 is checked O17.value = C2.value

Code:
Private Sub cbox1_Click()
If Me.cbox1.onValue = True Then
       Sheet1.Range("O17").Value = Sheet1.Range("C2").Value
End If


End Sub
With this code I need everytime click the checkbox

Please help me with a code that updates O17.Value automatically. I hope I could explain so you can understand what I want to do....


Thanks in advance for your help and time
Peter from Sweden, using Excel-365 on Windows
 

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Hello,

Have you set a cell link for your ActiveX checkbox ... ?
 

James006

Well-known Member
Joined
Apr 4, 2009
Messages
3,680
Say you have selected cell A1 as your LinkedCell for your ActiveX checkBox ...

In cell O17, you could have following formula:

=IF(A1,C2,"")

Hope this will help
 

excel_lelkes

New Member
Joined
May 16, 2017
Messages
30
Thanks for your answer James!
I didn´t know that I have to do that. I don´t know how, so now I'll google it and try

Regards
Peter
 

excel_lelkes

New Member
Joined
May 16, 2017
Messages
30
Thanks for your answer James!
I didn´t know that I have to do that. I don´t know how, so now I'll google it and try

Regards
Peter
I hope I didn´t offended you James, but for med the best way to learn, is to understand! That's why I want to google so I can learn;):eek:
 

excel_lelkes

New Member
Joined
May 16, 2017
Messages
30
With James tips on
linked cell
, I have solved the problem as follows:
  • 4 checkboxes linked to A10, A11, A12, and A13
  • this code
    Code:
    Sub resultQ()If Sheet1.Range("A10").Value = True And Sheet1.Range("A11").Value = False And Sheet1.Range("A12").Value = False And Sheet1.Range("A13").Value = False Then
           Sheet1.Range("O17").Value = Sheet1.Range("C2").Value
    ElseIf Sheet1.Range("A10").Value = True And Sheet1.Range("A11").Value = True And Sheet1.Range("A12").Value = False And Sheet1.Range("A13").Value = False Then
           Sheet1.Range("O18").Value = Sheet1.Range("C2").Value - Sheet1.Range("O17").Value
    ElseIf Sheet1.Range("A10").Value = True And Sheet1.Range("A11").Value = True And Sheet1.Range("A12").Value = True And Sheet1.Range("A13").Value = False Then
           Sheet1.Range("O19").Value = Sheet1.Range("C2").Value - (Sheet1.Range("O17").Value + Sheet1.Range("O18").Value)
    ElseIf Sheet1.Range("A10").Value = True And Sheet1.Range("A11").Value = True And Sheet1.Range("A12").Value = True And Sheet1.Range("A13").Value = True Then
           Sheet1.Range("O20").Value = Sheet1.Range("C2").Value - (Sheet1.Range("O17").Value + Sheet1.Range("O18").Value + Sheet1.Range("O19").Value)
    
    
    End If
    End Sub



  • worsheet change event:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
       Call resultQ
End Sub
It's maybe not the most elegant solution, but it works for me, at least localt on my computer....

Regards
Peter
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,105,930
Messages
5,508,177
Members
408,669
Latest member
AgsikapAko

This Week's Hot Topics

Top