ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format question (https://www.excelbanter.com/excel-programming/303231-format-question.html)

Mike NG

Format question
 
Private Sub Postage_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Postage = Format(Postage, "£ #,##0.00")
End Sub

I have the above code in one of my userforms for formatting the Postage
field when I exit from it

I have two amount fields above each other, and I really want to be able
to use Format so that each are properly right aligned
e.g.
£ 1,000.00
£ 9.99

I have the correct fixed font on each so they will be right aligned if
the right number of spaces are in the appropriate space, but can I get
Format to insert the right number of spaces for me?
--
Mike
Please post replies to newsgroup to benefit others
Replace dead spam with ntl world to reply by email

Bob Phillips[_6_]

Format question
 
Hammer to a nut!

Private Sub Postage_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Postage = Format(Postage, "#,##0.00")
Postage = "£" & Space(10 - Len(Postage)) & Postage
End Sub

and you will need to use a proportional font like Courier


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Mike NG" wrote in message
...
Private Sub Postage_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Postage = Format(Postage, "£ #,##0.00")
End Sub

I have the above code in one of my userforms for formatting the Postage
field when I exit from it

I have two amount fields above each other, and I really want to be able
to use Format so that each are properly right aligned
e.g.
£ 1,000.00
£ 9.99

I have the correct fixed font on each so they will be right aligned if
the right number of spaces are in the appropriate space, but can I get
Format to insert the right number of spaces for me?
--
Mike
Please post replies to newsgroup to benefit others
Replace dead spam with ntl world to reply by email





All times are GMT +1. The time now is 02:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com