+ Reply to Thread
Results 1 to 6 of 6

Macro to copy data -run Time Error

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

    Macro to copy data -run Time Error

    I have tried to write code to copy data from text "Assets" in Col A on sheet "Data Import" and two rows above up to "Total equity and liabilities" and 4 columns to the right i.e up to Col D on to sheet "Balance Sheet"


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


    I have copied the data manually to show the final result


    It would be appreciated if someone could kindly assist










    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    1,463

    Re: Macro to copy data -run Time Error

    It works perfectly for me. Check if you have made a typo in the name of any sheet.

    Artik

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

    Re: Macro to copy data -run Time Error

    It works now thanks

    I closed down Excel and then opened file and it worked

    I have run a run a macro first and when I tried to run this macro, I got a run time error. Not sure why after closing Excel and then running this macro this it suddenly would run with no run time error

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    20,138

    Re: Macro to copy data -run Time Error

    Howardc1001,

    Could be Find method.
    Find method remember the settings, so if you/your other code change the one of the protocol, it applies.
    And it will be setting back to default when you re-open.
    Since "Assets" have carriage return, it should be xlPart,
    try
    Please Login or Register  to view this content.
    Find method remember the settings, so if you/your other code change the one of the protocol, it applies.

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

    Re: Macro to copy data -run Time Error

    Thanks for the explanation and code

    Will try this and let you know

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

    Re: Macro to copy data -run Time Error

    Works perfectly Jindon-Many thanks

+ 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] copy and past data from one sheet to another giving me run time error 1004
    By damngroundhog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2019, 10:16 AM
  2. Run-time error '1004': VBA code fails to read and copy data from the files
    By mshaji in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2019, 05:14 PM
  3. Copy and Paste Rows macro- getting run-time error
    By gwbrooks1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2016, 05:16 PM
  4. [SOLVED] Run Time error when macro references copy range on a separate worksheet
    By CDEG in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-26-2013, 02:32 PM
  5. Run Time Error '6' Overflow - Macro That Find Text and Copy Range & Replace on Other Sheet
    By asgharhussaini in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2013, 04:34 AM
  6. [SOLVED] macro error Copy Time format to other Worksheet and continues copy range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2012, 01:30 PM
  7. Trying to copy a hidden sheet using macro, run-time error
    By mrgillus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-27-2009, 05:19 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