PDA

View Full Version : Copying Characters to the Right of a Selected String in a .txt file



pdotrun
07-09-2011, 02:49 PM
I am trying to make a VBA macro in Excel that searches for 5 characters to the right of a selected string in a .txt file and pastes it in the selected cell of choice. Can anyone help?

thanks

Kenneth Hobs
07-11-2011, 05:26 AM
Welcome to the forum!

I have looked at this but can not understand what need exactly. What application is your cursor in when you want to play this macro? Is the selected string in Excel or in the text file? Try posting an example text file with example data.

pdotrun
07-11-2011, 10:09 PM
I have several text file that have about a page of geographical text and i want to only extract the latitude, longitude, and elevations data from each of them. The format is the same but the data that i want to extract is different every time. So i was thinking that if i looked for a selected string that is consistant within each file i could export only the character to the right of the string.

e.g. within file#1 "latitude 123 23 12" -> String = "latitude "
within file#2 "latitude 123 22 30"

(In Excel) Furthermore, i would like to placed the files latitude, longitude and elevation along a row and the different files to be placed along a column.

I hope this makes sense,
thanks