how should show number form in label on userform

Alaa mg

Active Member
Joined
May 29, 2021
Messages
375
Office Version
  1. 2019
I have this code and I would show number format in label4 after select item from combobox1 ,but will shows error object required !:sick:
VBA Code:
Format(Label4.Caption, "#,##0.00#") = Cells(lRow, 5).Value
!
how fix it,please?
VBA Code:
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then Exit Sub
If ComboBox1.Value <> "" Then
Dim lRow As Integer
lRow = Application.Match(ComboBox1.Value, Sheets("CUSS").Range("B:B"), 0)

Format(Label4.Caption, "#,##0.00#") = Cells(lRow, 5).Value
End If


End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I think you may need something like this:
VBA Code:
Label4.Caption = Format(Cells(lRow, 5).Value,"#,##0.00#")
 
Upvote 0
Solution
You are welcome.

Just remember that anything you want to do (like apply the FORMAT function), has to be on the right side of the equation.
The left side is just the object you are applying it to (whether that be a variable, range, caption, etc).
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,596
Members
452,657
Latest member
giadungthienduyen

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