VBA help - Auto populate phrase based on conditions

AlwaysLearning2018

Board Regular
Joined
Nov 23, 2018
Messages
51
Hello all,

I am trying to automate a report that is run daily so I think I have to use VBA so it does not have to be touched. What I'm trying to figure out to do is for each instance in a row where I see "SA" in column J, I need the phrase "Load" to populate in every row in column O. Also if any row in column J = SWP and any row in column N = "invalid" then I need every row in column O that satisfies both criteria to = "Sweep".

Any ideas anyone can give would be greatly appreciated!!

Regards
 
You're welcome & thanks for the feedback
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Fluff,

Is there a way to use this same .Auto filter function to write code, if column F = "Option" and column N = "OK" to have Column O page l populate "Option Do not Instruct". I tried to add this to the end of what you had already given me but can't seem to get it to work.
 
Upvote 0
I tried the below, which is added to what you have already provided to me. I get an error that says No Cells were found.

.Auto filter 6, "Option"
.Auto filter 14, "OK"
.Columns(15).Offset(1).Resize(.Rows. count - 1).SpecialCells(xlvisible).Value = "Option do not instruct"
.Parent.AutoFilterMode = False
 
Upvote 0
You'll need to clear the filter on cols 10 & 11, like
Code:
.AutoFilter 10
and then the same again for 11
 
Upvote 0
Hi Fluff,

With the Auto filter function, is there a way to not have the macro "debug" if some of the criteria (ie Option isn't always in column 6 it may not be a choice on any given day) doesn't always appear on a report? I want to account for it when it does appear, but is there a way to have this code sort of skip over that filter if it's not available/ not on the sheet? When the criteria isn't in the column, the macro breaks.

Thanks!!!
 
Upvote 0
Put
Code:
On Error resume next
Just before the With statement &
Code:
On Error Goto 0
after the End With
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,846
Members
449,471
Latest member
lachbee

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