ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable Type - help me to solve this (https://www.excelbanter.com/excel-programming/278181-variable-type-help-me-solve.html)

choco140

Variable Type - help me to solve this
 
A1 content is '02/9085 but when I run the under mentioned program I
always get 01/02/9085 (feb-85), can anybody pls help me to keep the
data the way they are.

Sub Test()
Dim a As String
a = Range("A1").Value
Range("A1").Value = a
End Sub

Leo Heuser[_2_]

Variable Type - help me to solve this
 
One way:

Sub Test()
Dim a As String
a = Range("A1").Value
Range("A1").Value = "'" & a
End Sub

"'" : single quote between 2 doouble quotes.

--
Best Regards
Leo Heuser
MVP Excel

Followup to newsgroup only please.

"choco140" skrev i en meddelelse
om...
A1 content is '02/9085 but when I run the under mentioned program I
always get 01/02/9085 (feb-85), can anybody pls help me to keep the
data the way they are.

Sub Test()
Dim a As String
a = Range("A1").Value
Range("A1").Value = a
End Sub





All times are GMT +1. The time now is 01:18 PM.

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