How to auto-update label caption when it's look up changes?

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
94
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
Private Sub ComboBox18_Change()
Dim Val As String

ThisWorkbook.Worksheets("User Dashboard").Range("L18").Value = Me.ComboBox18.Value
Label13.Caption = Sheets("User Dashboard").Range("K24").Text
Label13.Visible = True
End Sub

ComboBox18 starts off empty and Label is invisible

I make a selection in ComboBox1, Combox2 and Combox3, and final selection in ComboBox18, Label text becomes visible.

Adjustments to ComboBox1, Combox2 and Combox3 should update Label13 on change.

Any assistance would be much appreciated!
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Saurabhj

Active Member
Joined
Jun 6, 2020
Messages
413
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,

What change is required in Label13 if we make changes in ComboBox1, Combox2 and Combox3 ?

Can you please upload your sheet to get more understanding.

Thanks,
Saurabh
 

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
94
Office Version
  1. 2016
Platform
  1. Windows
VBA Code:
Label13.Caption = Sheets("User Dashboard").Range("K24").Text

Just the value that Label13 is pulling from.
 

Saurabhj

Active Member
Joined
Jun 6, 2020
Messages
413
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi,

Please add below code.

Private Sub ComboBox1_Change()
Label13.Caption = Sheets("User Dashboard").Range("K24").Text
End Sub

Private Sub ComboBox2_Change()
Label13.Caption = Sheets("User Dashboard").Range("K24").Text
End Sub

Private Sub ComboBox3_Change()
Label13.Caption = Sheets("User Dashboard").Range("K24").Text
End Sub
 

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
94
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

@Saurabhj

Thank you for your response!

I attempted to use what you provided in a combobox_change I had for another feature but it doesn't activate.

VBA Code:
Private Sub RankCombo_Change()
Dim Val As String

ThisWorkbook.Worksheets("User Dashboard").Range("L15").Value = Me.RankCombo.Value
Label13.Caption = Sheets("User Dashboard").Range("K24").Text
End Sub

Is there a method I need to seperate to activate the label13.caption on change?

Thank you for your assistance.
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
It looks like the value of cell K24 is not being updated. If there is a formula in that cell, check its correctness. Furthermore, make sure that the worksheet is recalculated on changes.

VBA Code:
Private Sub UserForm_Initialize()
    Application.Calculation = xlCalculationAutomatic
End Sub
 

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
94
Office Version
  1. 2016
Platform
  1. Windows

ADVERTISEMENT

I put this in rankcombo_change

VBA Code:
Sheets("User Dashboard").Calculate
Label13.Caption = Sheets("User Dashboard").Range("K24").Text

It didn't work, thank you again, nothing yet
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
I assume that you have already monitored that the value of cell K24 actually changes (and nevertheless does not appear in the label).
Sounds like a mystery. What could be going on is that the Z-order of the label is different from what you assume and that it is (partly) covered by another control.
Anyway, the last two options I can come up with:
1) fully qualify your worksheet
2) yield to the OS and force a repaint of the userform (shouldn't be necessary but you never know...)
Finally, I would recommend setting a breakpoint on the Change Event procedure in VBE (F9 key). The procedure may not be triggered at all.
VBA Code:
    With ThisWorkbook.Worksheets("User Dashboard")
        .Range("L18").Value = Me.ComboBox18.Value
        Label13.Caption = .Range("K24").Text
    End With
    Label13.Visible = True
    Me.Repaint
    DoEvents
 

DarkJester89

Board Regular
Joined
Nov 5, 2017
Messages
94
Office Version
  1. 2016
Platform
  1. Windows
This did not work, but thank you for your due diligence
 

GWteB

Well-known Member
Joined
Sep 10, 2010
Messages
1,295
Office Version
  1. 2013
Platform
  1. Windows
Glad to help. Too bad you don't have a solution so far.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,009
Messages
5,622,143
Members
415,880
Latest member
Bruce0203

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
Top