Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Right Justifying Numbers

How about using IsNumeric?

eg.
If Not IsNumeric(Range("A1").Text) Then
....
End If


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Matt" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Right Justifying Numbers

Of course!!

Thanks Rob

Matt



-----Original Message-----
How about using IsNumeric?

eg.
If Not IsNumeric(Range("A1").Text) Then
....
End If


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Matt" wrote in

message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Justifying Text in a cell Dave Bennett, JSF, VDOT, Virginia Excel Discussion (Misc queries) 5 September 9th 08 03:20 PM
Justifying 2-line category names in bar charts Camille Charts and Charting in Excel 2 May 10th 08 06:16 PM
Justifying text of an axis mdicke Charts and Charting in Excel 1 April 21st 08 11:42 PM
Numbers Left-Justifying tc69 Excel Discussion (Misc queries) 4 April 30th 07 02:20 PM
Justifying text MarkN Excel Discussion (Misc queries) 0 June 14th 06 04:36 AM


All times are GMT +1. The time now is 12:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"