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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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:

A​
10​
R 4 000​

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

A​
10​
R 4 000​

<tbody>
</tbody>


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,215,111
Messages
6,123,155
Members
449,098
Latest member
Doanvanhieu

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