Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column with currency & text - how to format? Martin ©¿©¬ @nohere.net Excel Discussion (Misc queries) 2 May 11th 08 04:52 PM
Setting Column format as text deluth Excel Programming 8 July 14th 05 11:31 PM
Max value in 1 column when all values format are text coco Excel Programming 2 June 21st 05 07:40 PM
Column format as Text Bruce Roberson[_5_] Excel Programming 3 February 14th 04 02:08 AM
column format as text Sumesh[_2_] Excel Programming 2 February 9th 04 01:38 PM


All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"