Transfer Userform label value to Sheet as Currency

weaselmcguff

Board Regular
Joined
Feb 24, 2006
Messages
246
I have a userform that have 5 inputs and 2 Label(Result Boxes)
1. Part number
2. Cost
3. System Count
4. Physical Count
5. What to do with the variance.
Labels as
1. Total Cost
2. Variance

I am trying to copy/transfer the data to a spreadsheet. Everything goes ok till I try and save the Total Cost to the sheet. The spreadsheet for the other cells are formatted as Currency so that format works. But with the What to do with the variance. I let them put 1 of 4 option and then it pulls that option and the total cost to the spreadsheet. Since it is text and numbers it is formated on sheet as Text. The result that shows up on the sheet is: Adjust to GL5394 - -34.44 it should be: Adust to GL5394 - -$34.44 or Adjust to GL5394 - ($34.44)

How do i get it to change it to the Currency part.

Thanks for your time.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Not sure if you're using a formula or entering the text in the cell directly. If the first, you need to use the TEXT() worksheet function to format the value (34.44) as currency. If you're doing it in VBA, then you need to use the Format() function.
 
Upvote 0
Public totalcost


With Sheets("saveddata")
.Cells(lrow, 1).Value = Date
.Cells(lrow, 2).Value = partnumber
.Cells(lrow, 3).Value = physicaltotal
.Cells(lrow, 4).Value = m2ktotal
.Cells(lrow, 5).Value = variance
.Cells(lrow, 6).Value = unitcost
.Cells(lrow, 7).Value = totalcost
.Cells(lrow, 8).Value = recommend & totalcost
.Cells(lrow, 9).Value = comment1 & tb5.Value
.Cells(lrow, 10).Value = comment2 & tb6.Value
End With

That is my saved routine.

Just figured it out I had to format the totalcost

totalcost = Format(lb4.Caption, "($#,##0.00)")

by placing that in i was able to get it to work.


Thanks for your help
 
Upvote 0

Forum statistics

Threads
1,214,393
Messages
6,119,261
Members
448,880
Latest member
aveternik

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