To reflect a Currency (Rand) in a lable ona user form.

KyleOliver

New Member
Joined
Apr 16, 2016
Messages
31
Hi,

I have used the following code to take a value from cell "A10" in "Sheet1" to reflect in "Label1" on my userform. The code is working;
code: Label1.Caption = Sheets("Sheet1").Range("A10")

I have formated Cell "A10" on "Sheet1" to South African Rand value. The value in cell "A10" is "R40 000" but the value that is displayed in "Label1" on my userform is "40000"

How can I format "Label1" on my userform to display the "R40 000" currency?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Code:
 Label1.Caption = Worksheets("Sheet1").Range("A10").Text
 
Upvote 0
Hi shg,

Thank-you for your reply.

When I add the code: Label1.Caption = Worksheets("Sheet1").Range("A10").Text | it does not work - does not reflect a value.
When I add the code: Label1.Caption = Worksheets("Sheet1").Range("A10").Value | it shows the general number of 4000 in my label on my userform but not in currency format of R4 000 as it is in cell "A10" in the worksheet.

I need the cell currency value to reflect on the label on my userform as "R4 000".

Do you perhaps know how?
 
Upvote 0
Works for me:

[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
A​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
10​
[/td][td]
R 4 000​
[/td][/tr]
[/table]


Code:
Sub Kyle()
  With UserForm1
    .Show vbModeless
    .Label1.Caption = Range("A10").Text
  End With
End Sub
 
Upvote 0
Works for me:

[TABLE="class: grid"]
<tbody>[TR]
[TD="bgcolor: #C0C0C0"][/TD]
[TD="bgcolor: #C0C0C0"]
A​
[/TD]
[/TR]
[TR]
[TD="bgcolor: #C0C0C0"]
10​
[/TD]
[TD]
R 4 000​
[/TD]
[/TR]
</tbody>[/TABLE]


Code:
Sub Kyle()
  With UserForm1
    .Show vbModeless
    .Label1.Caption = Range("A10").Text
  End With
End Sub

Hi shg,

Thank you again for your reply but your knowledge is way more than mine.

This might be a stupid question but what comes before the ".Show vbModeless" & the ".Label1.Caption = Range("A10").Text" for the code you gave me?

Code:
Sub Kyle()
  With UserForm1
    .Show vbModeless
    .Label1.Caption = Range("A10").Text
  End With
End Sub
 
Upvote 0
I don't know -- your code. I'm just showing you how to set the caption.

You can ignore the Userform.show -- it's just what I did to demonstrate. The reason I used modeless is because the default appearance of a userform is modal, which means code suspends when you show it.
 
Last edited:
Upvote 0
Hi shg,

My code is as follows;

On the worksheet, I have a command button which opens the userform.

Code:
Private Sub CbSenManageSummary_Click()
    UfSenManTotals.Show
End Sub

And then on the userform I have a command button which runs the code to reflect the values of each cell in the worksheet which I have allocated.
Cell "F29" on the worksheet has been formatted to Currency "Rand value" but the code below does not reflect the "Rand value" in the label on the userform.

Code:
Private Sub CmbSumariseMidM_Click()
  LblMidmAsTotalGrand.Caption = Sheets("Mid-Management").Range("F29")
End Sub
 
Upvote 0
Because you have still not added .Text to the end of it.
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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