Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

VBA Deleting Entire Rows With Parameters

0

Hello To All - Attached is the file I need help with.  I have also provided the code in a separate tab.  The data contains employee's time and travel and the names etc have been replaced for obvious reasons. I am sturggling with the code.  I have bolded a few transactions only so the audiance can see what I am struggling with.  I need all transactions associated with the trip number where, either, column W or column X is True or if both column W and X are True regardless if another associated row reflects False and the rest of the rows I need deleted.  The first part of the trip number is the employee's identification and the second part reflects the trip

Example:

232425-ECHQ - I need both rows 22 and 23 because the overall trip has true regardless if row 22 has False.

123456 - DYU6 - I need all the rows starting from 29 to 35 even if W and X are mostly False because a true exists and the same goes for the following trip number 123456-E66X.

The bottom line is If a Trip Number has False in column W and in column X then I want them deleted but we have to be careful becasue some Trip Number rows may  have False in both columns W and X but are associated with another another row where there are True(s) and I don't want those deleted.

Please take a look at the code I have on the Code Tab as it doesn't seem to be doing what I need.  I hope you can help.

Gracias,

Cora

Answer
Discuss

Discussion

I'm confused, how do you know if a row is associated with another row?
don (rep: 1989) Oct 17, '18 at 2:21 am
Hello. If you look at the Trip_Number the first six numbers represents the Employee's ID which is in Column G.  The last four alpha/numeric sequence reflects the trip.  If you look at Fred Flinstone he has two different trips.  One ending DYU6 and another ending in E66X. I hope this answers your question.
CoraG (rep: 6) Oct 18, '18 at 1:06 pm
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login