Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Justifying Text in a cell | Excel Discussion (Misc queries) | |||
Justifying 2-line category names in bar charts | Charts and Charting in Excel | |||
Justifying text of an axis | Charts and Charting in Excel | |||
Numbers Left-Justifying | Excel Discussion (Misc queries) | |||
Justifying text | Excel Discussion (Misc queries) |