VBA automatically delete row if cell = 'Y'

charlesgy

New Member
Joined
Aug 7, 2017
Messages
11
I'm trying to find a code that will allow me to input a 'Y' and allows a row on the next sheet to stay populated.

but if the cell is empty I want the entire row to be delete.

so if c23 = Y
row 11 stays

if c23= (blank) or N
row 11 is deleted.


I will need a very similar code for around 50-60 cells, and with a corresponding row to be deleted/kept.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
I will need a very similar code for around 50-60 cells, and with a corresponding row to be deleted/kept.
Where is the ‘around 50-60 cells’ located? C23:C83?
 
Upvote 0
they are scattered all over the sheet.
there isn't any logical order.

is there a way I can copy the document into this thread?
 
Upvote 0
You can post small screen shots of your sheet using MrExcel HTML Maker or another add-in.
See this:
Attachments

or you can upload your workbook somewhere, maybe to dropbox.com
 
Upvote 0
so the first image is the cell's I need to have a 'Y' or 'N'

the second image is the rows I wish to be deleted if the cell is 'N' or just left blank
GEyzlCC.png
 
Upvote 0
I don’t see any “Y” or “N”. Are they should be in col C,G,K only?
And do you have merged cells in your data set?
 
Upvote 0
I haven't inputted any 'Y' or 'N' at the moment but yes they will be in col C,G and K.

and there is merged cells on the sheet.

but non of the cells that I'm using for this are merged.
 
Upvote 0
if c23= (blank) or N
row 11 is deleted.

So if “N” found in row 32 (in col C,G or K) then row 20 (in the other sheet) must be deleted?
What would happen if say C32 = “Y” and G32 = “N”?
 
Upvote 0
so each cell has its own row dedicated to it, so if C32 = 'Y' row 20 will stay
G32 is linked with row 49 so that would be deleted.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

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