![]() |
Fix format to text not number
Copying a text field using code with a very long number eg 0080251105280393
and 4171053200000224 the numbers are formatted as a variant/double after being copied with the numbers modified to fit in the 15 digit max of a number in Excel (eg. 80251105280393 and 4171053200000220 ). The Code: ------------- Dim strAssetSN as String strAssetSN = jpdDeliverySheet.Cells(10, 20) dellValidationSheet.Cells(5, 1).NumberFormat = "@" dellValidationSheet.Cells(5, 1) = strAssetSN Can you please help? I need the text copied across! |
Fix format to text not number
Try using
dellValidationSheet.Cells(5, 1) = "'" & strAssetSN that is, inserting a single quote before the text. -- Regards, Juan Pablo González Excel MVP "Rowlesar" wrote in message ... Copying a text field using code with a very long number eg 0080251105280393 and 4171053200000224 the numbers are formatted as a variant/double after being copied with the numbers modified to fit in the 15 digit max of a number in Excel (eg. 80251105280393 and 4171053200000220 ). The Code: ------------- Dim strAssetSN as String strAssetSN = jpdDeliverySheet.Cells(10, 20) dellValidationSheet.Cells(5, 1).NumberFormat = "@" dellValidationSheet.Cells(5, 1) = strAssetSN Can you please help? I need the text copied across! |
Fix format to text not number
This has worked, thank you very much. More testing to be done later today.
Andy "Juan Pablo González" wrote: Try using dellValidationSheet.Cells(5, 1) = "'" & strAssetSN that is, inserting a single quote before the text. -- Regards, Juan Pablo González Excel MVP "Rowlesar" wrote in message ... Copying a text field using code with a very long number eg 0080251105280393 and 4171053200000224 the numbers are formatted as a variant/double after being copied with the numbers modified to fit in the 15 digit max of a number in Excel (eg. 80251105280393 and 4171053200000220 ). The Code: ------------- Dim strAssetSN as String strAssetSN = jpdDeliverySheet.Cells(10, 20) dellValidationSheet.Cells(5, 1).NumberFormat = "@" dellValidationSheet.Cells(5, 1) = strAssetSN Can you please help? I need the text copied across! |
All times are GMT +1. The time now is 01:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com