text file page breaks

ermccarthy

Board Regular
Joined
Feb 15, 2002
Messages
224
I have a macro that uploads a .prn file into my workbook, and then formulas run off of that uploaded data. My problem is sometimes the text file puts in page breaks which appear as small rectangles after the number (at the end of a line). With those there, my formulas do not work. Is there anyway to make these go away either with a command in the macro during the upload process, or by running a macro to "search and destroy" these pesky little boxes....(PS the boxes are always there in the file, but sometimes that fall in areas that don't bother me, like after a label, so they are not always in the same place)

Any ideas??

_________________
Russell
This message was edited by ermccarthy on 2002-02-21 11:06
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
It might be easiest to replace these characters using a system editor such as EditPlus or BBEdit. Using Excel's CODE function can you tell us what the ASCII code is for these characters?
 
Upvote 0
ok......so I copied the page break into a cell and type in the next cell: =Code(A1) this returned a value of 12.

Therefore how do I tell it to search the entire area looking for this character and delete it, using this value??
 
Upvote 0
Are you using Excel 2000? If so, try this (you must have the range that may contain page breaks highlighted):

Code:
Sub RemovePageBreaks()
    Dim cl As Range

    For Each cl In Selection
        If InStr(cl.Text, Chr(12)) Then
            cl = Replace(cl.Text, Chr(12), "")
        End If
    Next cl
End Sub

If you're not using XL 2K, let me know. Otherwise, hope this helps!

-Russell
 
Upvote 0
On 2002-02-21 11:05, ermccarthy wrote:
I have a macro that uploads a .prn file into my workbook, and then formulas run off of that uploaded data. My problem is sometimes the text file puts in page breaks which appear as small rectangles after the number (at the end of a line). With those there, my formulas do not work. Is there anyway to make these go away either with a command in the macro during the upload process, or by running a macro to "search and destroy" these pesky little boxes....(PS the boxes are always there in the file, but sometimes that fall in areas that don't bother me, like after a label, so they are not always in the same place)

Any ideas??

_________________
Russell
This message was edited by ermccarthy on 2002-02-21 11:06

Or, simply...

Sub Macro1()
Selection.Replace What:=Chr(12), Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,255
Members
448,879
Latest member
oksanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top