ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to Keeping Same Display Value on 2 Workbooks (https://www.excelbanter.com/excel-programming/441518-need-keeping-same-display-value-2-workbooks.html)

GEdwards

Need to Keeping Same Display Value on 2 Workbooks
 
I am using Excel 2003 and have 2 XLS files.

In Workbook1 cell A1 is defined as =TEXT(NOW(),"yymmddhhmmss") which, for
example, correctly displays the format of 100409153548.

Workbook2 has a macro (thanks to Ron de Bruin) that copies data from
Workbook1 to Workbook2. My issue is the value from Workbook1 cell A1 shows
in Workbook2 as ...

1.00409E+11

How can I get the copied cell in Workbook2 to display as 100409153548?


Part of the macro that copies the data over uses the Value property to copy
a range to Workbook2, as follows...

With SourceRange
Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = SourceRange.Value

ozgrid.com

Need to Keeping Same Display Value on 2 Workbooks
 
Try
With DestRange
.Value = Format(SourceRange.Value,"yymmddhhmmss")
.EntireColumn.AutoFit
End With



--
Regards
Dave Hawley
www.ozgrid.com
"GEdwards" wrote in message
...
I am using Excel 2003 and have 2 XLS files.

In Workbook1 cell A1 is defined as =TEXT(NOW(),"yymmddhhmmss") which, for
example, correctly displays the format of 100409153548.

Workbook2 has a macro (thanks to Ron de Bruin) that copies data from
Workbook1 to Workbook2. My issue is the value from Workbook1 cell A1
shows
in Workbook2 as ...

1.00409E+11

How can I get the copied cell in Workbook2 to display as 100409153548?


Part of the macro that copies the data over uses the Value property to
copy
a range to Workbook2, as follows...

With SourceRange
Set DestRange = DestRange.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = SourceRange.Value




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

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