View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
matt matt is offline
external usenet poster
 
Posts: 92
Default Right Justifying Numbers

Hi Everyone

I'm using a spreadsheet as an interface for running
queries. On of the fields is 10 characters in width.
My users will not see it that way however and will just
key in the number of characters that appear on their
reports. To save them putting spaces on the front I have
used below on a Worksheet_Change macro. It works great
for letters but numbers can be entered without the spaces
appearing on the left.

Thanks in advance

Matt

Sub trythis()
Dim strPONoFrom As String * 10
Dim strPONoTo As String * 10

Application.EnableEvents = False
RSet strPONoFrom = Range("A1").Text
Range("A1").Value = strPONoFrom
Application.EnableEvents = True
End Sub