Label Caption

proctk

Well-known Member
Joined
Dec 24, 2004
Messages
840
Hi

I'm trying to get the value on my userform to equal the last value used in column 7 on sheet3.

I want it to recalculate the label value on each worksheet change.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I don't actually think you will be able to use the worksheet change event with the userform.

I may be wrong though.

Perhaps you could explain further exactly what you want to do.
 
Upvote 0
Perhaps something like this.
Code:
Label1.Caption = Worksheets("Sheet3").Cells(65536,7).End(xlUp).Value
 
Upvote 0
Hello Kevin,
Assumming your userform is being shown as vbModeless, (which it would need to be in order for manual changes to be made while it's showing) you can use the worksheet change event like this:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
With UserForm1.Label1
    .Caption = Cells(Rows.Count, 7).End(xlUp).Value
End With
End Sub
It would probably be a good idea to use the initialize event like Norie showed you too.

Hope it helps.
Dan
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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