format column to text

H

husky101

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
 
J

Jim Cone

Paul,

wks2.Columns("D:D").NumberFormat = "@"

Jim Cone
San Francisco, USA


<[email protected]>
wrote in message
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top