UsedRange.Copy copiess ##### instead of text

D

dwight

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")
 
D

Dave Peterson

Long strings don't play nice with Text format.

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

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