+ Reply to Thread
Results 1 to 3 of 3

Find given text and number each line incrementally

  1. #1
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Find given text and number each line incrementally

    Hi All

    I'm trying to search and find lines in my Word document which contain the letters 'bx' , and then place an incrementing number by the line above in each.

    For example

    AAAAA
    123456BX67

    nnnnn
    8976BX55

    ioip
    18987BX34


    would become


    01.AAAAA
    123456BX67

    02.nnnnn
    8976BX55

    03.ioip
    18987BX34

    The 'bx' in each might be upper or lower case.

    Could someone suggest some VBA to satisfy this?

    Grateful for any advice.

    Last edited by CDandVinyl; 07-06-2023 at 07:48 PM.
    Using Excel , Word and Access 2003 - For the whole of 2024

  2. #2
    Registered User
    Join Date
    12-13-2018
    Location
    US
    MS-Off Ver
    Office 2016
    Posts
    7

    Re: Find given text and number each line incrementally

    If these lines are "individual" complete paragraphs (e.g., you have hit the enter key at the end of the line to make a new line), then:

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-18-2013
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    641

    Re: Find given text and number each line incrementally

    many thanks gmaxey. I gave it a go and find it gives an error for some scenarios. It says 'Object variable or With block variable not set'. Other times it works fine.

    The debug screen highlights this line :

    Please Login or Register  to view this content.
    I'll check through to see if it's the 'enter' at the end of each line which is the issue.

    Last edited by CDandVinyl; 07-07-2023 at 09:08 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find and match a text value for a corresponding number
    By Neyme in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-07-2021, 04:49 PM
  2. [SOLVED] Find Number into the Text & Number
    By Yaghoub61 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-22-2020, 11:23 AM
  3. [SOLVED] Find number in parenthesis and replace with text and increasing number
    By lamdathoa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-06-2020, 10:09 AM
  4. Find and replace; number to text
    By PainFoinmr in forum Excel General
    Replies: 4
    Last Post: 04-16-2020, 09:12 AM
  5. VBA: Multiple text and number columns. Find list and number of unique words
    By first_jaguar in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-14-2017, 09:58 PM
  6. [SOLVED] find number after certain text
    By papasmurfuo9 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-25-2015, 11:36 AM
  7. Replies: 4
    Last Post: 11-13-2012, 02:16 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1