+ Reply to Thread
Results 1 to 11 of 11

Macro to copy data starting from certain Text up to row before new text

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Macro to copy data starting from certain Text up to row before new text

    I have text on sheet "Finance Data" in Col A "Statement of Directors Responsibility"

    I want to copy the data In Col A starting with Directors Resposibility up to Row before "audit report" and paste this in A1 on sheet "Statement of Dir Resp"

    It would be appreciated if someone could provide me with the code to do this

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,477

    Re: Macro to copy data starting from certain Text up to row before new text

    And drumroll...sample file?
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,562

    Re: Macro to copy data starting from certain Text up to row before new text

    Please Login or Register  to view this content.
    This works if "up to" means "down to"
    Last edited by jolivanes; 06-10-2021 at 12:21 PM.

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Re: Macro to copy data starting from certain Text up to row before new text

    Sorry Sintek

    Should have uploaded sample data

    See attached sample data
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Re: Macro to copy data starting from certain Text up to row before new text

    Hi Jolivanes

    I get a run time error "Object variable or with block variable not set"

    Please Login or Register  to view this content.
    Kindly check & amend code

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,477

    Re: Macro to copy data starting from certain Text up to row before new text

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Re: Macro to copy data starting from certain Text up to row before new text

    Many thanks for the help Sintek

    It copies the data perfectly

    I've learnt something new

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,477

    Re: Macro to copy data starting from certain Text up to row before new text

    Only amended jolivanes' code...all credit to him...

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,562

    Re: Macro to copy data starting from certain Text up to row before new text

    @ sintek
    Thank you

    @ Howarddc1001
    It all boils down to supplying the proper information which, I would have thought, you should know after 1300+ posts.
    Unless you suffer from the same ailment as I have, age related forgetfulness.

    All kidding aside, I assume that sintek has straightened you away.

  10. #10
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Re: Macro to copy data starting from certain Text up to row before new text

    Thank Jolivanes

    Sintek has sorted me out

  11. #11
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,776

    Re: Macro to copy data starting from certain Text up to row before new text

    Hi Sintek


    It would be appreciated if you could kindly amend your code below so to as to make only copy where there is an exact find i.e STATEMENT OF DIRECTORS' RESPONSIBILITY FOR FINANCIAL REPORTING and to copy up to row before INDEPENDENT AUDITOR'S REPORT



    Please Login or Register  to view this content.

    I did not realise yesterday that if he text is not exact , then the incorrect data would be copied which I did not have in my sample data. I apologise for this but did not realise it would be an issue


    Kindly check &n amend
    Attached Files Attached Files

+ 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. [SOLVED] Import and append data from the text file into worksheet, starting at a specific row.
    By excelicus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-09-2018, 02:04 AM
  2. VBA macro to find specific text, then copy into a new WB data underneath such text
    By tempforVBA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-01-2018, 09:31 AM
  3. Copy range to another sheet starting from where certain text ends
    By bgonen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-23-2015, 11:16 PM
  4. [SOLVED] How do I copy and paste all the text starting with REF-?
    By Buzz57 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-03-2014, 07:42 PM
  5. Display Text After a Common Starting Text
    By HangMan in forum Excel General
    Replies: 6
    Last Post: 01-23-2013, 01:10 PM
  6. Macro to search for text then copy data from that row starting in different column
    By balston2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2013, 10:43 AM
  7. Replies: 13
    Last Post: 11-29-2012, 08:25 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