ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to get the format of this cell right? (https://www.excelbanter.com/excel-programming/436839-how-get-format-cell-right.html)

ppeer

how to get the format of this cell right?
 
When I let go:

Selection.Replace " ", Replacement:="-", Lookat:=xlPart, _
SearchOrder:=xlByColumns,
MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

" " is entered by means of an array:
Words = Array(" ", "+", "/", "---", "--", "&")

on a cell containing: 5 a
I would expect to get: 5-a as a result.

Unfortunately, it produces 5:00:00-AM. How can I solve this tiny but
frustrating problem?


best regards
Peter

Otto Moehrbach[_2_]

how to get the format of this cell right?
 
Format the cell as TEXT before entering a value to that cell. HTH Otto

"ppeer" wrote in message
...
When I let go:

Selection.Replace " ", Replacement:="-", Lookat:=xlPart, _
SearchOrder:=xlByColumns,
MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

" " is entered by means of an array:
Words = Array(" ", "+", "/", "---", "--", "&")

on a cell containing: 5 a
I would expect to get: 5-a as a result.

Unfortunately, it produces 5:00:00-AM. How can I solve this tiny but
frustrating problem?


best regards
Peter




All times are GMT +1. The time now is 03:48 AM.

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