display $ sign in excel sheet

S

sam

Hi All, I want to display a '$' sign in excel sheet once user inputs the
'amount'. the cell in excel is populated through a userform. Here is my code
to format the textbox in userform:

Amount.Text = Format(Amount.Text, "$#,###.00")

I am getting the $ sign in the text box field, but once its populated in
excel sheet I dont see the $ sign, I just see 6,444.00
Here is my code to print the input in excel through the userform:

ws.Cells(10, 8).Value = Me.Amount.Value

Thanks in Advance
 
D

Dave Peterson

Apply the number format you want:

with ws.Cells(10, 8)
.numberformat = "$#,###.00"
.Value = Me.Amount.Value
end with
 
R

ryguy7272

Right-click the tab, and paste this code into the window that opens:

Private Sub Worksheet_Change(ByVal Target As Range)
Set t = Target
Set H = Range("A:H")
s = "$"
If Intersect(t, H) Is Nothing Then Exit Sub
Application.EnableEvents = False
t.Value = s & t.Value
Application.EnableEvents = True
End Sub

Format as Currency. Oh, change the range to suit your needs...

HTH,
Ryan---
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top