Deleteing Text In A Text File

Aug 4, 2008

is there any automated way to delete text from a text file?

View 9 Replies


ADVERTISEMENT

Deleteing Rows Starting With Value (text)

May 22, 2006

Using an external UNIX program that quieries a database, I export all the data found based on my query and export the report as a text file. THe text file can be up to 1 MB of raw text.

Selecting all text and pasting the data into collum 1 using PASTE SPECIAL -->(TEXT)

All Data is in Collum A

Each record returned has between 40-50 values each on a seperate row, only 10 of which I need.

I am looking for a way to find the rows that begin with the unwanted field, and then delete the entire row.

Otherwise ignore the row.

IE:
AUDFI : (data path loc here)
BILLNUM : 060606
CUTNUM : (0000)
SD : 120012
ED : 121259
CC : 123456789 MATERIAL LISTS AND ITEMS
COMMENT : Multiple lines of text here
with continuing free form data, numbers, operators,

then the next data file would repeat:

ADUFI : (data path loc here)
...
...
...
etc.,

In the above example, I want to delete the rows AUDFI, & CUTNUM and move the below items up to take the empty rows place. The BILL NUM, SD,ED, and COMMENT are filed that are always kept (as well as others). Each record has roughly the same data, each tailored to an event or object.

The number of rows of data dumped into excel can easily exceed 50000, about 200 - 1500 records in the report.

After wards, the data is dumped to a text file for easier analysis.

In BASIC my line might look like
5 START
10 if A:$="AUDFI :" then delete row, move below contents up.
20 if A:$="CUTNUM :" then delete row, move below contents up.
30 END

(I think there needs to be a loop since the vaules AUDFI and CUTNUM (as well as other unwanted fields can occurr 200 - 1500 times each.)

View 7 Replies View Related

Looping, Open Text File, Copy Text, Close Text File

Sep 18, 2009

I have an existing spreadsheet with a column of strings (actually VIN numbers). These numbers correllate to a bunch of text files, that can exist in one of three folders (UsernameDesktop1, 2, or 3) on my desktop. What I need the macro to do is:

1) get the filename from A2 (A1 is a heading row)
2) Find the appropriate text file in one of the three folders
3) Put the folder name into I2
4) Scan the text file for some strings, and copy some data that follows those strings into J2:O2 (I can handle programming this)
5) Close the text file
6) repeat above for the remainder of filenames (about 1800 files)

View 3 Replies View Related

Text File Import With Text To Columns Splitting Same Text Differently

Nov 21, 2007

I have a macro which imports data from a mainframe dump text file and performs 'Text to Columns' on the imported data so that formula in the spreadsheet can act on the data. The code works perfectly well when I use it, but if a different user logs on and performs exactly the same mainframe dump and import macro the Text to Columns action splits the raw data in a different way and the result is that the split renders the formulae useless.

I've experimented a little and for some reason it appears that the 'Field Info' parameters which are produced when the Text to Columns function is recorded in a macro differ between users even though the raw data is exactly the same.

FieldInfo:= _
Array(Array(0, 1), Array(18, 1), Array(35, 1), Array(56, 1), Array(70, 1), Array(88, 1), _
Array(102, 1))

View 6 Replies View Related

Insert Text To One File - Remove Text From Equivalent Column In Another File?

Aug 13, 2013

Got a slight problem; I am making a "worker-plan", where you should be able to write a name on one file and have it updated (removed) from the equivalent columns on another file automatically. Here's an example with two separate projects:

Project 1 before and after changes:
Attachment 257366
Attachment 257367

Project 2 before and after changes:
Attachment 257368
Attachment 257369

You can see here how I intended it to work. When one worker is moved from Project 1 to Project 2, that worker should also be removed from those weeks in Project 1. The previous worker from Project 2 should also be removed from those weeks (in Project 2).

Are there any formulas that can make this work automatically? All week numbers will belong to the same columns in all files.

Edit: There are 30 files that should be syncronized, not just two.. I could also gather all files into one file with sheets, instead of having seperate files.

View 2 Replies View Related

Search Word For Text And Send Values Next To Text To Excel File

Apr 30, 2009

I am using Windows XP and Office 2003.

I am looking to automate a process where information is sent to someone in a text format and they in turn transfer that data to an excel file. It basically looks like this (but includes a lot more info):

Service Request #: 123456
Instrument Type: New Instrument
Lot/Serial #: 123456
SR Type: Product Complaint
Service Coverage: Maintenance Agreement

The info on the left (text preceding the colon) is always the same but the values following the colon can change. The excel file has all of the text before the colon and they just enter the information into the cells. I am looking to make it so that an Excel macro (or maybe a word/outlook macro) automatically scans the text document and sends this info to the exact same cells in excel every time.

The text file is actually a message from an Oracle database and I am not going to be able to make any changes to the way the data comes in.

View 9 Replies View Related

Importing Text File (excel Treat Row Of Text As Number)

Dec 1, 2007

I created a vb macro to open a text file then process the file then close the file. Here is my problem:

Problem: THe text file has rows of data in it as follows

5155111111551511111111111511111111111111111

This row of text gets converted to

5.16E+42

because excel treats the row of text as a number but i dont want it to do this transition.

When i save the file and then reopen it using say NOTEPAD i see 5.16E+42 and not the long string of text.

View 9 Replies View Related

Combine Cell Content With Text File & Save As Text

Feb 21, 2008

- I have excel file with data I need
- I have fixed txt(html) template that i need to integrate Excel information into
- Final result that I want to achieve is saved .txt(html) file with combination of fixed information (text) and data from excel cells.

I need to writing a VBA code for each of above (integrating text & cells, saving results as text)

View 5 Replies View Related

Editing Using VBA - Find Text Strings In Text File

Dec 7, 2012

I have a large .txt file that I would like to edit using VBA. What I would like to do is to find each of the following text strings in the text file :

De:
De :
Envoye
A:
Objet:

If the character right before those text strings is not a carriage return (chr(13) then add a carriage return.

I would like the code to read each line in the text file and execute the task mentioned above.

View 9 Replies View Related

Importing Text Space Delimited Text File?

Jan 16, 2014

I found this code that import TAB delimited text file. I would like to import space delimited text file instead.

VB:
Option Explicit
Sub ReadTxtFiles()
Const conSpath As String = "C:"

[Code]....

View 6 Replies View Related

Split Text File Into Smaller Text Files

Mar 15, 2005

I'm trying to take a large text file and break into smaller text size files. I want to open the data file, and parse into 5000 line smaller files.

Here is what I have based off of some MS KB
Sub LargeFileImport()

'Dimension Variables
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
Dim CounterMax As Double
Dim sPath As String
Dim FileCounter As Double
'Output File

View 9 Replies View Related

Automate Text File Imports Where Text Differs

May 5, 2008

I am trying to automate in VBA the process of importing of txt file to Excel range. The columns widths are not static. So I can't use recoded code of Text to Column wizard process as columns alignment arguments, (ie FieldInfo:= Array(Array(0, 1) would need to be changed daily. I have also tried to import the text in one column and then apply a code of TextToColumns to automatically split the text by multiple columns. But some of the text would be moved to the left under wrong column titles. I think this is because the text is not tab or comma delimited. It's just aligned using multiple spaces.

Is it possible to write a code to split the text by columns based on alignment of 2 first rows. For example, import rows 6 and 7 from the text in one column, then apply texttocolumn method like this:

.TextToColumns DataType:=xlDelimited, consecutivedelimiter:=True, Space:=True

Then, based on this alignments take arguments for the Open File method like this:

Workbooks.OpenText Filename:= _
"filename", Origin:=xlMSDOS, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(10 _
, 1), Array(20, 1), Array(31, 1), Array(39, 1), Array(48, 1), Array(57, 1), Array(66, 1),Array(75, 1)), TrailingMinusNumbers:=True

View 9 Replies View Related

Create Text File And Input Text?

Feb 27, 2014

how can I create a text file in a folder called test and then input texts in this created textfile

so say I had 2 input values

1 said hello other was james

i need to create textile in this folder and then have this written in the textile and saved (printed like the below)

hello

james

thank you

editing and inputting some text in an existing textfile and inputting the Inputbox values at the end of the text file like the above

View 7 Replies View Related

Extract Specific Text From A Text File

Jun 22, 2006

I had VBA run a third-party program ("HYD") using data listed in my spreadsheet. HYD produces a textfile and I want to extract a number from that log (line 58, columns 6-10 to be exact).

I started with

Open "C:TempHYDLOG.TXT" For Input As #1

but I don't know how to have it skip down to line 58 or which function to use to extract the number I want. I've read through tons of help files and forums but none of them treat anything as simple as scrolling down to specific lines.

The entire subroutine up to that point is as follows: ....

View 4 Replies View Related

Read Text File And Write Text

Feb 16, 2007

What if you have text that are hyperlinked to a txt file and you want to read from it and copy it into excel. What can I do then. Here is what I have been working on so far:


Sub GoToHyperLink()
Dim cell As Range
Dim link As Hyperlink
Dim Textline As String

Range("C2:C13").Select

For Each cell In Selection

Selection.Hyperlinks(1).Follow NewWindow:=False

I can not get it to write it to excel.

View 9 Replies View Related

Deleting Text From An Open Text File

Feb 22, 2007

I'm using excel to parse txt a file with account numbers in it. If it finds a dodgy number I want it to delete the entire line in the text file. I have manage to write the code that opens the file and locates the dodgy numbers, however I'm not sure whether it is posible to select the line and delete it.

View 6 Replies View Related

Extracting Known Text From A Text File

Mar 1, 2007

How do I open a text file, read all the lines from said text file & extract a value in the form of a string. For ex., if I know that a certain line in the file might contain this text: Market Value=1234, then I would like to extract the value 1234 (the text Market Value is a constant) from that line & dumps it into a cell in the Excel file.

View 3 Replies View Related

Importing A Text File Into A Text Box

Apr 11, 2007

I am trying to import a text file into a textbox on a form. It is to help the user to select the body of an email and the signiture.

View 2 Replies View Related

Write VBA Code That Will Generate Text File With ALL Changes Made To Excel File

Jun 4, 2012

Is it possible to write vba code that will generate a text file with ALL changes that were made to an excel file. Ex. If Cell A17 = "Monday, June 4, 2012" and a user updates Cell A17 to "N/A", I would like to know what the value was before and after the udpate was made.

View 8 Replies View Related

Browse A Text File With 10 Textual Lines And Rewrite The Contents In The Same File

Feb 5, 2010

i want to browse a text file with 10 textual lines and rewrite the contents in the same file (starting from line number 11) from bottom to top.

View 9 Replies View Related

Import Text File Into File Where Rows Exceed Excel Row Limit

Jun 3, 2009

I have a workbook with many spreadsheet named Sheet1, Sheet2 and so on. Each sheet is filled completely upto 65536 rows. This data is being picked up from a CSV file. In this file there are sites with each site there is a assciated set of data. What happens is the data that extracts data does not differntiate between sites and when it reaches to the end of worksheet it splits the data into next sheet. So I am trying to create a macro to check each spreadsheet starting with the last sheet in the work book for example last sheet in the workbook is seven it should go to sheet6 and if there is a blank row after row 64000 it should cut all the rows and move them to sheet7. Then it should goto sheet5 and do the same and keep on doing it until it reaches sheet1.

View 9 Replies View Related

Saving Multiple Workbooks At One Time/file As A Text File

Mar 16, 2007

found the following code which works for 1 workbook at a time. I am trying to save 7 workbooks at 1 time. Is it possible?

Sub SaveAsCell()
Dim strName As String

On Error Goto InvalidName
strName = Sheet1. Range("V77")
ActiveWorkbook.SaveAs strName

It will work on the first sheet but none after that. I need to have each workbook saved with the value in cell V77. Also if that is possible, is it possible to change where the file is saved as well?

Right now I have a master workbook that will open the 7 other workbooks, paste data onto several pages in each workbook. I would like the macro to save the workbooks. The workbooks are named: 02 Tuesday, 03 Wednesday, 04 Thursday, 05 Friday, 06 Saturday, 07 Sunday, 08 Monday.

View 9 Replies View Related

Naming Excel File With Name Of Input Text File?

May 20, 2013

I have a macro that takes a text file as input and produces an excel file as output. I want a macro to store the name of the text file in a variable (without its file extension).

View 1 Replies View Related

Excel 2010 :: Is File Of File Type Text

May 16, 2014

Using Excel 2010

As I am looping through files in a folder, I would like to determine if the file is a text file.

The problem is that all extensions are variable in a pattern such as .078, .051, etc.

In this instance, the extensions are numeric, but I'm trying to figure out a way to handle that is all encompassing to include *.txt, *.tsv, *.csv, *.prn, etc......

How can I handle these efficiently?

View 6 Replies View Related

Save File As Text Using Cells For Path & File Name

Dec 20, 2009

How to save a file, with file- name. but the directory is to be read in worksheet "towns" in Cell1 (brussels) and filename in worksheet "names" in cell B2 (i.e. winter), so it saves to c:russelswinter.txt as a wordpad or kladblok txt file, that keeps a number, so each time we push a button "go back from worksheet names to worksheet towns" the "number" that is saved in the txt document goes up by value +1. In Flemisch, the "old" code goes as follows, and saves the number in the txt file Factuurnummer7.txt. But I want that the file name (here: FactuurNummer7) can be a variable text issue, which has to be read - as already noticed - in cell B2 (with the word WINTER). So the are 2 worksheets: towns, ans names

pad$ = Application.DefaultFilePath
'controle = Dir(pad$ + "FactuurNummer7.txt")
'If controle = "" Then GoTo EerstAanmaken
'Open pad$ + "Factuurnummer7.txt" For Input As #10
'Input #10, Nummer1
'Close #10......................

View 2 Replies View Related

Open Text File From File Manager Vs. Within Workbook

Oct 2, 2006

I've encountered a bit of an odd one. I am opening a tab delimited file, which has been sved as an xls. When I open from file manager, it opens correctly. When I open from Excel, I have to go through 3 screen dictating how the data is set up, and the end result is that a couple of the numbers come through as text, rather than numbers.

Failing an explanation - how do you open workbooks as file system objects - currently I am opening them using

Workbooks.Open Filename:=wb.Path & "/" & ws. Range("B1").Value

If I open them by mimicking the FM, perhaps it will work OK.

View 2 Replies View Related

Convert Each Column Of An Workbook File To New Text File

May 30, 2007

I want macro which export each excel column to new text file. The data in excel file is number. The column has only 5 rows that means each new text file should contain five lines of one column. It looks simple but couldn't manage to do macro for it. I have very big data set in one excel file, and have to be splitted into text files. The file name in new text files can be any kind as long as it can be in some sort of order for each export.

View 2 Replies View Related

Compile Unique Text File Tickers To 1 File

Aug 10, 2007

I am reading a portion of a string with the FileSystemObject in excel vba. The data I need from the string has a variable length(3 to 5 characters long). Unfortunately if I just pull the first 5 characters from the string, it can include numbers and anything after the data that I don't want. Can someone help me figuer out how to do this.

View 9 Replies View Related

Excel Text Search Through Different Types Of Text And Action Based On Text

Oct 14, 2008

1. Search an excel sheet "column" for a particular type of text and insert values based on that text (if found) in another column.

e.g I have column A1 to A10 with different types of text. I would like to search for the keyword "Risk is high" OR "Risk=High" for each cell in the column and insert a "1" if found beside it's corresponding "B" column. If not found, I would like to insert a "0".

So, if the text "Risk is high" OR "Risk=High" was only found in A6, I would like B6 to be "1". Rest of the values in the B column would be "0's", since the text was not found in any of the other cells.

View 10 Replies View Related

Converting Excel File To A Text File

Apr 19, 2008

converting to a text file from Excel.

The below code worked in 2003, but now I have put it in 2007 with just a change in the Range to work with.

What I'm getting is a Text file with, for lack of a better term, hyroglifics (sp).
Not the numbers that I should get like I got in 2003....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved