Results 1 to 3 of 3

Macro VBA find last instance of a word

Threaded View

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    2

    Macro VBA find last instance of a word

    Hi

    I have a spreadsheet which I am trying to put in a macro to add a new page (below the current page in the same worksheet) so that users who are unfamilair with Excel can simply do this. I have got the macro to copy the cells I want and can get it to paste but the issue is I don't always want it to paste in the same place. The current document is 1 page long but it may need to be up to 10 pages long. I am trying to get it to find the last instance of the word "COMMENTS" and then paste the copied info 3 rows below that.

    I am a complete novice at VBA but have come up with the following code so far:
    Sub addnewpage()
    '
    ' addnewpage Macro
    
        Range("A14:N70").Select
        Selection.Copy
        Do Until Cells(x, 1).Value Like "COMMENTS"
        Loop
        Cell(x, 3)
          
        ActiveSheet.Paste
    End Sub
    Although I know this is not right and needs more in it. I can't figure out how to tell it to find the last COMMENTS and how to paste 3 rows down from that.

    Any help appreciated - thanks!!
    Last edited by Leith Ross; 09-16-2009 at 05:18 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

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