+ Reply to Thread
Results 1 to 6 of 6

Macro to copy specific items in a column

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

    Macro to copy specific items in a column

    where there is text "Sale" in Col b on sheet1, I want to copy the items from Col A : Col D and paste on sheet


    I have tried to write code to do this, it cannot get a run time error "Method of range of object_Global failed"


    this part is highlighted when getting the run time error

    Please Login or Register  to view this content.
    See full code below

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Howardc1001; 08-06-2019 at 11:44 AM.

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Macro to copy specific items in a column

    Change the period to a comma before the second Cells.
    Please Login or Register  to view this content.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

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

    Re: Macro to copy specific items in a column

    Thanks for the help. Only one item is being copied. I have highlighted 3 items in yellow containing sale in the text that is to be copied

    Please Login or Register  to view this content.

    kindly test & amend

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

    Re: Macro to copy specific items in a column

    Maybe try something like this. Not tested.
    Please Login or Register  to view this content.

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

    Re: Macro to copy specific items in a column

    Thanks Jolivanes

    Code works 100%

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

    Re: Macro to copy specific items in a column

    Thanks for letting us know that all is well in SA.
    Good luck

+ 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 selected listbox items and paste to a specific sheet
    By Rabb in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-15-2016, 08:17 AM
  2. [SOLVED] Macto to copy data untill last used column
    By dobracik in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-20-2015, 02:12 AM
  3. How to count # of items followed by a specific value in a column?
    By mlevin77 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-01-2015, 06:01 AM
  4. [SOLVED] Copy rows with specific text in specific column into specific sheet
    By Valemaar in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-22-2014, 03:23 PM
  5. [SOLVED] VBA copies rows based on specific items in a column but need to rename items created
    By djfscouse in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2013, 11:38 PM
  6. Macto to copy words from text file to excel
    By maor.wn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2013, 02:51 AM
  7. How do I copy specific items to another worksheet?
    By HEATHERCOX in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-28-2005, 10:06 AM

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