VBA - If Then Function

Jaredbuoy

New Member
Joined
Oct 25, 2022
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I recorded a macro but it is very ineffecient as I copied the code, dragged to fill etc but, I would like to perform the following but in VBA code

=IF(I2=I1,N1&", "&E2,E2)

Where it loops until the end where the approver stops (the sheets can vary in how many row it can be).

The idea behind the code is to filter companies .Value <> "Burger Bar" (deleted all other columns for ease), sort the approver a-z then perform the function =IF(I2=I1,N1&", "&E2,E2) then only keep the longest chain according to the approvers email so only 1 mail is sent with all the workers (I have another VBA that automatically sends the mail)

I just want to clean up the code and make it more responsive and flexible.

I highly appreciate any time given to assisting me, thank you

1666727235849.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,225,739
Messages
6,186,738
Members
453,369
Latest member
juliewar

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