ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UsedRange.Copy copiess ##### instead of text (https://www.excelbanter.com/excel-programming/320847-usedrange-copy-copiess-instead-text.html)

[email protected]

UsedRange.Copy copiess ##### instead of text
 
I have a macro that opens a tab delimited file. It then copies the data
into a new worksheet. One of the colunns has data 1000 characters, if
the column is formatted at text, 256 # get copied to the new sheet. If
the column is formatted as general, the correct data is copied.

I know a cell's width can only be 256, but the data can be 32,767. Why
is this happening?

Thanks

Workbooks.OpenText Filename:=l_ImportFileName, DataType:=xlDelimited,
Tab:=True, TextQualifier:=xlTextQualifierNone,
FieldInfo:=array_FieldInfo
Workbooks(txtBaseName).Activate
Worksheets(txtWorkSheetName).UsedRange.Copy
Application.DisplayAlerts = False
Workbooks(txtBaseName).Close
Application.DisplayAlerts = True

Workbooks(txtTossWorkBookName).Activate

Worksheets(GlobalTossSheet).Activate

ActiveSheet.Paste
Destination:=Worksheets(GlobalTossSheet).Range("B9 ")


Dave Peterson[_5_]

UsedRange.Copy copiess ##### instead of text
 
Long strings don't play nice with Text format.

Change that cell's format to General and you should be ok.



wrote:

I have a macro that opens a tab delimited file. It then copies the data
into a new worksheet. One of the colunns has data 1000 characters, if
the column is formatted at text, 256 # get copied to the new sheet. If
the column is formatted as general, the correct data is copied.

I know a cell's width can only be 256, but the data can be 32,767. Why
is this happening?

Thanks

Workbooks.OpenText Filename:=l_ImportFileName, DataType:=xlDelimited,
Tab:=True, TextQualifier:=xlTextQualifierNone,
FieldInfo:=array_FieldInfo
Workbooks(txtBaseName).Activate
Worksheets(txtWorkSheetName).UsedRange.Copy
Application.DisplayAlerts = False
Workbooks(txtBaseName).Close
Application.DisplayAlerts = True

Workbooks(txtTossWorkBookName).Activate

Worksheets(GlobalTossSheet).Activate

ActiveSheet.Paste
Destination:=Worksheets(GlobalTossSheet).Range("B9 ")


--

Dave Peterson


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

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