Yodelayheewho
Member
Hello,
I thought I figured out how to maintain currency formatting between the userform and the worksheet.
I started with this code
But, whenever I saved a row using the userform command button, the Excel worksheet would undo the currency format (despite having the column formatted as currency). So, I kept researching and trying different things. I then added this code to the click event of the Update/Save command button and thought I found the solution.
However, I did a victory dance too soon. Because I have a second worksheet that reports off the first using index/match. When I save a row via the userform command button, the currency formatting transfers from the userform to both worksheets. However, Excel is not including the updated rows in the subtotal calculation. It's as if Excel is reading these as text. To get the column to add correctly, I have to go through the Text to Columns steps.
I tried adding this code to initialization and had no luck.
I've also tried this...
I would appreciate the help.
I thought I figured out how to maintain currency formatting between the userform and the worksheet.
I started with this code
Code:
'Format currency appears AFTER user types in numbers'
Private Sub txtPOAmt_AfterUpdate()
txtPOAmt = Format(txtPOAmt, "$#,##0.00")
End Sub
But, whenever I saved a row using the userform command button, the Excel worksheet would undo the currency format (despite having the column formatted as currency). So, I kept researching and trying different things. I then added this code to the click event of the Update/Save command button and thought I found the solution.
Code:
txtPOAmt = Format(txtPOAmt, "$#,##0.00")
However, I did a victory dance too soon. Because I have a second worksheet that reports off the first using index/match. When I save a row via the userform command button, the currency formatting transfers from the userform to both worksheets. However, Excel is not including the updated rows in the subtotal calculation. It's as if Excel is reading these as text. To get the column to add correctly, I have to go through the Text to Columns steps.
I tried adding this code to initialization and had no luck.
Code:
txtPOAmt = Format(txtPOAmt, "$#,##0.00")
I've also tried this...
Code:
'***Formats currency appears AFTER user types in numbers...NOT WORKING***
Private Sub FormatCurrency()
Dim sh As Worksheet
Set sh = ThisWorkbook.[Master]
sh.Range("S2:S", "X2:X").NumberFormat = "#,##00.00"
End Sub
I would appreciate the help.