![]() |
format column to text
Hi NG,
I have this code where I copy one column to another worksheet, in preparation for an import into a system. The columns I have, in some cases are numeric and need to be imported as text. In some cases the column may have text and numbers, but need to be text import. Can any suggest how to modify this code to give me a text column? Sub HeadCpy() Application.ScreenUpdating = False Dim wks1 As Worksheet Dim wks2 As Worksheet Set wks1 = Workbooks("IMPUT CATTLE W NW Version 1.1.xls").Worksheets("IMPUT") Set wks2 = Workbooks("IMPUT CATTLE W NW Version 1.1.xls").Worksheets("Output") With wks1 .Range(.Range("D2"), .Range("D2").End(xlDown)).Copy wks2.Range("D2") End With Set wks1 = Nothing Set wks2 = Nothing Application.ScreenUpdating = True End Sub Any assistance is appreciated. TIA Paul |
format column to text
Paul,
wks2.Columns("D:D").NumberFormat = "@" Jim Cone San Francisco, USA wrote in message oups.com Hi NG, I have this code where I copy one column to another worksheet, in preparation for an import into a system. The columns I have, in some cases are numeric and need to be imported as text. In some cases the column may have text and numbers, but need to be text import. Can any suggest how to modify this code to give me a text column? Sub HeadCpy() Application.ScreenUpdating = False Dim wks1 As Worksheet Dim wks2 As Worksheet Set wks1 = Workbooks("IMPUT CATTLE W NW Version 1.1.xls").Worksheets("IMPUT") Set wks2 = Workbooks("IMPUT CATTLE W NW Version 1.1.xls").Worksheets("Output") With wks1 .Range(.Range("D2"), .Range("D2").End(xlDown)).Copy wks2.Range("D2") End With Set wks1 = Nothing Set wks2 = Nothing Application.ScreenUpdating = True End Sub Any assistance is appreciated. TIA Paul |
format column to text
Thanks very much Jim.
It works a treat. Cheers Paul Jim Cone wrote: Paul, wks2.Columns("D:D").NumberFormat = "@" Jim Cone San Francisco, USA |
All times are GMT +1. The time now is 05:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com