Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Extracting account details


Hi

I've been given a pdf document and asked to extract the account number name
and address for printing on to a label.

I have adobe standard and have converted the pdf into accessible txt but I
am struggling to get the account number. Its a 10 digit number at the start
of the line but never the same line number or the same interval of lines
between it and the next account number. Is there any way I can search for a
10 digit string at the start of each line?


Thanks

Wendy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Extracting account details

If there are a lot of spaces or commas, then this might work. It just
checks to see if the first 10 characters has a space or a comma and
returns false to indicate that line doesn't have an account number.
If there are other common characters, then you could also search for
those, but to search for any non-number would be a little more complex
and likely require a custom function.

=AND(ISERROR(FIND(" ",LEFT(A20,10))),ISERROR(FIND(",",LEFT(A20,10) )))
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Extracting account details

Are you searching a text in a file? In a variable in VB code? The text in a
single cell? The text in a range of cells? Somewhere else?

--
Rick (MVP - Excel)


"SundayGirl" wrote in message
...

Hi

I've been given a pdf document and asked to extract the account number
name and address for printing on to a label.

I have adobe standard and have converted the pdf into accessible txt but I
am struggling to get the account number. Its a 10 digit number at the
start of the line but never the same line number or the same interval of
lines between it and the next account number. Is there any way I can
search for a 10 digit string at the start of each line?


Thanks

Wendy


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Extracting account details

On Wed, 22 Jul 2009 19:57:13 +0100, "SundayGirl"
wrote:


Hi

I've been given a pdf document and asked to extract the account number name
and address for printing on to a label.

I have adobe standard and have converted the pdf into accessible txt but I
am struggling to get the account number. Its a 10 digit number at the start
of the line but never the same line number or the same interval of lines
between it and the next account number. Is there any way I can search for a
10 digit string at the start of each line?


Thanks

Wendy


I don't know what you want to do with the results, but here is a macro that
cycles through a selected range of cells, and extracts any 10 digit strings
that are at the start of a line. In adjacent columns it also prints the
original address and the full contents of that line.


To enter this Macro (Sub), <alt-F11 opens the Visual Basic Editor.
Ensure your project is highlighted in the Project Explorer window.
Then, from the top menu, select Insert/Module and
paste the code below into the window that opens.

To use this Macro (Sub), <alt-F8 opens the macro dialog box. Select the macro
by name, and <RUN.

==============================
Option Explicit
Sub AcctNums()
Dim rg As Range, c As Range
Dim rDest As Range
Dim i As Long

Set rg = Range("A1:A100") 'or wherever your data is
Set rDest = Range("D1")
'note that we clear out possible destination cells
Range(rDest, rDest(rg.Rows.Count + 1, 3)).Clear
rDest.Value = "Account Numbers"
i = 1
For Each c In rg
If Left(c.Value & " ", 11) Like "##########[!0-9]" Then
i = i + 1
rDest(i, 1).NumberFormat = "@"
rDest(i, 1).Value = Left(c.Value, 10)
rDest(i, 2).Value = c.Address
rDest(i, 3).Value = c.Value
End If
Next c
End Sub
==============================
--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
account # entry needs to return the account description placerpone Excel Worksheet Functions 1 November 9th 09 03:02 AM
Freezing Details Teedie Excel Discussion (Misc queries) 6 July 3rd 08 06:19 PM
Can a service account be embedded in Workbook so that by default the macros are run with service account credentials and not the user credentials??? Divya Sanam Excel Discussion (Misc queries) 0 July 20th 06 05:15 PM
details of month srinivasan Excel Worksheet Functions 9 July 15th 05 08:42 AM
AVI details Greg[_12_] Excel Programming 1 September 17th 03 05:32 PM


All times are GMT +1. The time now is 08:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"