DuckDuckGo Conditional Format

MrDB4Excel

Active Member
Joined
Jan 29, 2004
Messages
348
Office Version
  1. 2013
Platform
  1. Windows
I have read through various sites about adding a conditional format to VBA and found too much confusion. Not being very prolific in creating a VBA macro that can do this I am turning to Mr. Excel in the hopes someone can enlighten me and help to bring this to a conclusion.
First of all, I need this macro to run on any sheet within the workbook.
I have twelve such workbooks, each indicated by the month, i.e. 01-January.xlsm, 02-February.xlsm, 03-March.xlsm, 04-April.xlsm, etc., and each one needs to acquire and have available this macro. This may imply that I don’t want to have to open each of these workbooks and add this macro but that this macro will automatically become available as I open subsequent xlsm files. If not then so be it and I will simply copy this macro into the remaining eleven workbooks.
The macro needs to provide a selection prompt (because each sheet in a workbook will have different range selections), and from there it simply executes the desired attributes of a conditional format. This conditional format is as follows: highlight cell rules, and text that contains: “DuckDuckGo”, the format is simply to highlight these cells in this selected range with yellow fill that contains the text DuckDuckGo.
The attached Xl2bb Mini Sheet is a very small example of what some days produce, sometimes as many as 200 to 500 rows of web searches, and as you can see this is only what I have accumulated thus far today 19 March 2024. Obviously, many days include website visits that range from music, science, physics, cosmos, computer IT, DIY Handyman, religion, philosophy, politics, travel, humor, movies and films, healthcare, recipes, miscellaneous, financial, and this is only a small portion of the things I daily visit. I say this only because a sheet showing hundreds of site visits will only have a smaller portion of those visits relevant to DuckDuckGo.
Any help will be very much appreciated as this is something I do every day, that is, I collect all website history for each day, and before the computer shuts down at day's end, I delete all history. This exercise allows me to save important website visits while cleaning out my C drive.

03-March.xlsm
ABCDE
2DExcel VBA To Allow User To Select A Range With An InputBox | Get input from the user using Input Box - YouTubehttps://www.youtube.com/watch?v=lL8z7WRigK4IT-Technical-Computer3/19/2024 07:31
3Iexchow to cause vba to ask for user input for a range selection to finish the vba at DuckDuckGohttps://duckduckgo.com/?hps=1&q=how+to+cause+vba+to+ask+for+user+input+for+a+range+selection+to+finish+the+vba&atb=v319-1DuckDuckGo>>>Excel3/19/2024 07:29
4Iexchow to create a quick access toolbar button that automatically applies a special conditional format to a selected range at DuckDuckGohttps://duckduckgo.com/?hps=1&q=how+to+create+a+quick+access+toolbar+button+that+automatically+applies+a+special+conditional+format+to+a+selected+range+&atb=v319-1DuckDuckGo>>>Excel3/19/2024 07:25
5DIs there a way to apply conditional formatting with one click? - Microsoft Communityhttps://answers.microsoft.com/en-us/msoffice/forum/all/is-there-a-way-to-apply-conditional-formatting/84868157-d819-4cba-a69c-099f88ce7515IT-Technical-Computer3/19/2024 07:25
6DUsing Conditional Formatting with Excel VBA - Auto VBAhttps://www.autovbax.com/learn/vba/conditional-formatting.htmlIT-Technical-Computer3/19/2024 07:41
7DUsing Conditional Formatting with Excel VBA - Automate Excelhttps://www.automateexcel.com/vba/conditional-formatting/IT-Technical-Computer3/19/2024 07:27
8DVBA To Allow User To Select A Range With An InputBoxhttps://www.thespreadsheetguru.com/select-range-with-inputbox/IT-Technical-Computer3/19/2024 07:29
9Iexcvba to create a special conditional format to a selected range at DuckDuckGohttps://duckduckgo.com/?hps=1&q=vba+to+create+a+special+conditional+format+to+a+selected+range&atb=v319-1DuckDuckGo>>>Excel3/19/2024 07:27
10EHERE GOES NOTHING | Spray Foaming Our Shipping Container - YouTubehttps://www.youtube.com/watch?v=uamfKXoNaZIDIY-Handyman-Misc3/19/2024 08:11
11EOff Grid Solar Container Home Vs. Spring Hail Storms | Green House Prep - YouTubehttps://www.youtube.com/watch?v=CWTUNYSot6QDIY-Handyman-Misc3/19/2024 08:15
12JWhen patients ask if a crown can be biomimetic...✨ #shorts #dentalcrowns #dentist - YouTubehttps://www.youtube.com/shorts/p5aEp2_T3cwHealth-Life-Homecare3/19/2024 08:12
_19
Cell Formulas
RangeFormula
D2:D12D2=IF((ISERROR(XLOOKUP(A2,'01Sort-Types'!$R$47:$R$73,'01Sort-Types'!$S$47:$S$73,0))),"",(XLOOKUP(A2,'01Sort-Types'!$R$47:$R$73,'01Sort-Types'!$S$47:$S$73,0)))
 

Attachments

  • MultipleSheetsPer DaysOfMonth.png
    MultipleSheetsPer DaysOfMonth.png
    184.1 KB · Views: 10
I am not sure if I should post the following here or if it should be posted as a new subject. It seems so similar so perhaps it belongs here as a followup to the original post.

So later today I researched about how to have user input for any text in lieu of what the code now does, namely =ISNUMBER(FIND(““DuckDuckGo”“,” & Replace(Rng.Cells(1, 1).Address, “$”, ““) & “))”
In other words, a user input that is then placed in the code where we see DuckDuckGo so on the fly we could highlight all cells that contain the text supplied by the user input.
I did find some things about this but unfortunately, it is above my pay grade, meaning I don't have the foggiest how to make it work.
Does anyone have an idea of how this could work?
An addin that would incorporate the ability to highlight all cells containing instances of user input text or number could become a powerful search, locate, and highlight tool.
Here is the code I have that now works using DuckDuckGo as the text to find:

Sub High_Light()
Dim Rng As Range
Dim FormatRuleInput As String

‘Get A Cell Address From The User to Get Number Format From
On Error Resume Next
Set Rng = Application.InputBox( _
Title:=“Number Format Rule From Cell”, _
Prompt:=“Select a cell to pull in your number format rule”, _
Type:=8)
On Error GoTo 0

Rng.FormatConditions.Add Type:=xlExpression, Formula1:= _
“=ISNUMBER(FIND(““DuckDuckGo”“,” & Replace(Rng.Cells(1, 1).Address, “$”, ““) & “))”
Rng.FormatConditions(Rng.FormatConditions.Count).SetFirstPriority
With Rng.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Rng.FormatConditions(1).StopIfTrue = False
End Sub

And here is some code I found that is relevant to user input:

Public Sub MyInputBox()

Dim MyInput As String
MyInput = InputBox(“This is my InputBox”, “MyInputTitle”, “Enter your input text HERE”)


If MyInput = “Enter your input text HERE” Or MyInput = ““ Then
Exit Sub
End If
MsgBox “The text from MyInputBox is “ & MyInput
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I have edited my previous code Post #2 so that you input the required text for high lighting. Previous CF is deleted and fresh text is high lighted. Change code suitably for your requirement.
Sub High_Light()
Dim Rng As Range
Dim FindText$

FindText = InputBox("Enter the text to highlight.", "Find Text")
Set Rng = ActiveSheet.UsedRange
Rng.FormatConditions.Delete
Rng.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=ISNUMBER(FIND(""" & FindText & """," & Replace(Rng.Cells(1, 1).Address, "$", "") & "))"
Rng.FormatConditions(Rng.FormatConditions.Count).SetFirstPriority
With Rng.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Rng.FormatConditions(1).StopIfTrue = False
End Sub
 
Upvote 0
Excellent!!! Works very well. Thank you.
By the way, when I went to mark it as a solution then it stated that this solution would replace the other solution. These are all solutions for varying remedies for the original post.
So as far as I am concerned these solutions are all viable and worthy of note.
 
Upvote 0

Forum statistics

Threads
1,223,704
Messages
6,173,984
Members
452,540
Latest member
haasro02

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