Code to delete entire rows if zero in a particular column (after pasting data in a new tab)

AidanDanby

Board Regular
Joined
Jan 24, 2013
Messages
176
Office Version
  1. 365
Hi All,
Please can someone give me some code that will do the following:

1) Paste all data from Sheet1 into a new sheet.
2) Delete entire rows if there is a zero in column A

Cheers,

Aidan
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hello Aidan,

With the high-lighted line of code, it appears that Sheet2 (which is a sheet code not sheet name) is incorrect. What is the name of your destination sheet or, better still, its sheet code? You can find the sheet code in the Project Explorer (to the left of the code field) with the sheet names in parentheses and the sheet codes directly before the sheet names.

Cheerio,
vcoolio.
 
Upvote 0
Hello Aidan,

With the high-lighted line of code, it appears that Sheet2 (which is a sheet code not sheet name) is incorrect. What is the name of your destination sheet or, better still, its sheet code? You can find the sheet code in the Project Explorer (to the left of the code field) with the sheet names in parentheses and the sheet codes directly before the sheet names.

Cheerio,
vcoolio.
1692017580563.png
 
Upvote 0
That snippet was from Vcoolio's code.
Yes, I could see that from the image you posted but my (first) question was about the error message itself "Please report the full error message"

My second question was
Have you tried the post #3 code?

BTW, the codes should be in a standard module, not the sheet module. In the vba window use the menu to Insert -> Module and put the code there.
Having said that, I don't think that is the reason for your error on this occasion with vcoolio's code at least
 
Upvote 0
So the sheet codes I've used are correct. Sheet1 is the source sheet and sheet2 is the destination sheet. On which row does your data start and which row is the headings row?

Cheerio,
vcoolio.
 
Upvote 0
So the sheet codes I've used are correct. Sheet1 is the source sheet and sheet2 is the destination sheet. On which row does your data start and which row is the headings row?

Cheerio,
vcoolio.
The first reference point in Sheet1 would be A2 (where the first zero sits).
The header row is the Row1.
1692019308853.png
 
Upvote 0
Yes, I could see that from the image you posted but my (first) question was about the error message itself "Please report the full error message"

My second question was


BTW, the codes should be in a standard module, not the sheet module. In the vba window use the menu to Insert -> Module and put the code there.
Having said that, I don't think that is the reason for your error on this occasion with vcoolio's code at least.
When I ran the Post #3 code I got the error mentioned in Post #6.
 
Upvote 0
Hello Aidan,

Please use the XL2BB sample file uploader (refer to the top of any reply form) to upload a sample of your workbook. Your data set out, as per the image, appears problematic to both codes supplied and we'll need something to work and test with. We can't do so with the image. If your data is sensitive then please use dummy data.
You could also use a free file transfer site, such as WeTransfer, to upload a sample. If you use such a site, then please make sure to post the link to your file back here.

Cheerio,
vcoolio.
 
Upvote 0
Hello Aidan,

Please use the XL2BB sample file uploader (refer to the top of any reply form) to upload a sample of your workbook. Your data set out, as per the image, appears problematic to both codes supplied and we'll need something to work and test with. We can't do so with the image. If your data is sensitive then please use dummy data.
You could also use a free file transfer site, such as WeTransfer, to upload a sample. If you use such a site, then please make sure to post the link to your file back here.

Cheerio,
vcoolio.
Hi - I cannot download - it states 'This file type is not supported in Protected View'
 
Upvote 0

Forum statistics

Threads
1,215,230
Messages
6,123,752
Members
449,118
Latest member
kingjet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top