multi column based macro

Tonyk1051

Board Regular
Joined
Feb 1, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
heres the link to the sample file to use macro
T2 TEST MACRO.xlsm

below are all the rules i follow manually and putting them all in one macro would just cause the data to be incorrect so i need it to be 3 separate macros. ive worded it best as can. thanks

Macro 1
If column S has keyword “YES” then put in column H in house repair UNLESS column N has the word Telescope, Lenses, Camera, projector then leave alone ALSO if value is 500 or greater leave alone but highlight the line in blue

If column T has a date that is older than 3 years from todays date put in column H in house repair

IF column O is under $20 then put in column H LR



Macro 2
If column F has keyword Manfrotto, Godox, Yashica or Tiffen and column G is TESTED CONFIRMED DEFECTIVE or TESTED CONFIRMED DAMAGED then put in column H “in house repair”

If column F has keyword Viewsonic, LG or NEC , column N has keyword “monitor” and column W is Defective / unspecified then put in column H pic needed

If column F has keyword SANUS or Middle Atlantic then put in column H Levi stuff

If column F has keyword Dell and column G has TESTED CONFIRMED DAMAGED and column N has the word monitor then put in column H LSI IF it’s not then put in house repair

If column F has keyword HP or Apple and column G is blank or MANUFACTURE and column N has keyword “Printers, Workstations, Monitors, Desktop, Macbook, Tablet, Smartwatches or Notebook” then put in column H TT

If column F is Sony, column N has keyword “headphones” and column G is TESTED CONFIRMED DEFECTIVE or TESTED CONFIRMED DAMAGED then put in column H in house repair, if column G is blank put in column H TT

If column F is B+W and column G is either TESTED CONFIRMED DEFECTIVE OR TESTED CONFIRMED DAMAGED then put in column H in house repair

If column F is Google and column G is MANUFACTURE put in column H TT




Macro 3
If column G has keyword TESTED CONFIRMED DAMAGED and column O is less than 300 then put in column H in house repair

If column G has keyword Liquidate then put in column H in house repair UNLESS column N has the word “Monitors” or “Printers” put in column H LSI

If column W has key word “Open Box” highlight the line in yellow

If column N has key word PRINTERS-Inkjet Printers, PRINTERS-Laser Printers, PRINTERS-Large Format Printers, PRINTERS-3D Printers, PRINTERS-Shredders AND column G has keyword “tested confirmed defective or tested confirmed damaged put in column H in house repair

If column N has keyword Mirrorless Cameras, DSLR Cameras or Point & Shoot Cameras and column P has ZNFI then put in column H TT

If column N has keyword “SCANNERS-Flatbed & Document Scanners” and column W is Defective /unspecified or Damaged put in column H TT

If column N has key word Commercial Monitors, Computer Monitors, Camera Monitors or Recording Monitors and column G is TESTED CONFIRMED DAMAGED and column O is below 800 put in column H in house repair

If column N has keyword Motherboards, column G is TESTED CONFIRMED DAMAGED and column O is less then 300 then put in house repair in column H
 
Hi Tony,

maybe this will give you some hints on where to start as most of the stuff is repetetive and a macro recording may be used as a guide to have some code to work on (no, macro code is mostly hard-coded and needs a rework but if you supply the basic code I'm sure you get a response with a reworked code).

MrE_1229714_1702B13_multi column based_230212.xlsm
ABCDEFGHIJKLMN
1MacroColumnConditionActionColContentsOther ActionMore Infowhat to use
21aSYEScombinedHin house repairAdvanced Filter
31aNneither Telescope, Lenses, Camera, projector combinednonenoneAdvanced Filter
41aO>500actionnonenonecolour rowblueAdvanced Filter
5
61bT<=today - 3 yearsactionHin house repairnonenoneAutoFilter
7
81cO<20actionHLRnonenoneAutoFilter
9
102aFeither Manfrotto, Godox, Yashica or TiffencombinedAutoFilter
112aGeither TESTED CONFIRMED DEFECTIVE or TESTED CONFIRMED DAMAGEDactionHin house repairnonenoneAutoFilter
12
132bFeither Viewsonic, LG or NECcombinednoneAutoFilter
142bNmonitorcombinednoneAutoFilter
152bWDefective / unspecifiedcombinedHpic needednonenoneAutoFilter
16
172cFSANUS or Middle AtlanticactionHLevi stuffnonenoneAutoFilter
18
192dFDellcombinedAutoFilter
202dGTESTED CONFIRMED DAMAGEDcombinedAutoFilter
212dNcontains monitoractionHsee far right, unclear to menonenoneAutoFilterspecify: LSI IF it’s not then put in house repair
22
232eFeither HP or ApplecombinedAdvanced Filter
242eGblank or MANUFACTUREcombinedAdvanced Filter
252eNPrinters, Workstations, Monitors, Desktop, Macbook, Tablet, Smartwatches or NotebookactionHTTnonenoneAdvanced Filter
26
272fFSonycombinedAutoFilter
282fNheadphonescombinedAutoFilter
292fGeither TESTED CONFIRMED DEFECTIVE or TESTED CONFIRMED DAMAGEDactionHin house repairnonenoneAutoFilter
30
312gFSonycombinedAutoFilter
322gNheadphonescombinedAutoFilter
332gGblankactionHTTnonenoneAutoFilter
34
352hFB+WcombinedAutoFilter
362hGeither TESTED CONFIRMED DEFECTIVE or TESTED CONFIRMED DAMAGEDactionHin house repairnonenoneAutoFilter
37
382iFGooglecombinedAutoFilter
392iGMANUFACTUREactionHTTnonenoneAutoFilter
40
413aGTESTED CONFIRMED DAMAGEDcombinedAutoFilter
423aOless than 300actionHin house repairnonenoneAutoFilter
43
443bGLiquidatecombinedAutoFilter
453bNeither Monitors or PrintersactionHLSInonenoneAutoFilter
46
473cGLiquidatecombinedAutoFilter
483cNexclude Monitors or PrintersactionHin house repairnonenoneAutoFilter
49
503dWOpen Boxactioncolour rowyellowAutoFilter
51
523eNeither PRINTERS-Inkjet Printers, PRINTERS-Laser Printers, PRINTERS-Large Format Printers, PRINTERS-3D Printers, PRINTERS-ShredderscombinedAdvanced Filter
533eGeither tested confirmed defective or tested confirmed damagedactionHin house repairnonenoneAdvanced Filter
54
553fNeither Mirrorless Cameras, DSLR Cameras or Point & Shoot CamerascombinedAdvanced Filter
563fPZNFIactionHTTnonenoneAdvanced Filter
57
583gNSCANNERS-Flatbed & Document ScannerscombinedAutoFilter
593gWeither Defective /unspecified or DamagedactionHTTnonenoneAutoFilter
60
613hNeither Commercial Monitors, Computer Monitors, Camera Monitors or Recording MonitorscombinedAdvanced Filter
623hGTESTED CONFIRMED DAMAGEDcombinedAdvanced Filter
633hObelow 800actionHin house repairnonenoneAdvanced Filter
64
653iNMotherboardscombinedAutoFilter
663iGTESTED CONFIRMED DAMAGEDcombinedAutoFilter
673iOless then 300actionHin house repairnonenoneAutoFilter
MrE1702B13


Before applying the Advanced Filter I added a worksheet and set it up like this:

T2 TEST MACRO.xlsm
ABCDEF
1DFIProduct groupProduct groupProduct groupProduct groupBooknet
2YES<>Telescope<>Lenses<>Camera<>projector<500
Criteria AdvFilt
Cell Formulas
RangeFormula
B2B2="<>Telescope"
C2C2="<>Lenses"
D2D2="<>Camera"
E2E2="<>projector"
F2F2="<500"


I named Range("A1:F2") as myCrit which I can use as Criteria range when starting the Advanced Filter on the sheet in question.

HTH
Holger
As always haho be, your help is appreciated.
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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