• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

copy data greater than 0

ymdeek

New Member
hello

I am new to macro and I need your help to create a macro that copy only the data with value > 0 to a new workbook. As you can see from the table, some data have no value so I am trying to avoid copying them by using if condition. Any one can help?

Refer image below
upload_2018-3-19_17-32-11.png

Note: ignore the zeros in Country


▬▬▬▬▬▬▬▬▬ Mod edit : thread moved to appropriate VBA forum !
 
Last edited by a moderator:
Hi @ymdeek, Good day and welcome to the forum :awesome:

Other than what Marc advised, you can also use Power Query to a new workbook with a few simple setps:
  • Go to PQ
  • From File
  • Select your file
  • Select Sheet (or table) which contain your data, say Sheet1
  • Press Edit
  • Simply apply filter for <> (not equals to) 0 for Country column and
  • > (Greater than) 0 for Amount column
  • Select unnecessary columns you don't want to copy, use Ctrl+Mouse Click to select multiple columns and select Remove Columns
  • Go to Close and load (Done).
Now you just need to refresh the query whenever there is any update in source.

Regards,
 
Back
Top