Suppose one column contains different e-mail addresses, I need to highlight all addresses in yellow - who has e-mail = @ gmail.com. How to do it?
Closed due to the fact that the issue is too common for MSDN.WhiteKnight , 0xdb , user192664, Jarvis_J , user300000 October 25 '18 at 21:01 .
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See βHow to ask a good question?β For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
3 answers
Select the range of cells in which you need to change the color (where you have the address). Next Home - Conditional Formatting - Rules for Selecting Cells - The text contains ... in the opened window, write the text, which must be in the cell (in your case, gmail.com). Set the color for how the cell will be painted
- thanks @MaximK !!! what you need :) - Patrick
Use "Conditional Formatting -> New Rule". There, set the formatting ranges and conditions.
For cases where you need to quickly view the data for different values ββof the desired.
The formatting range is column A. Single cell for the criterion - B2
Select column A , tab Home-Conditional-Formatting-Create_Rule-Use_ Formula
=ΠΠΠΠ‘Π($B$2;A1) Set the desired format (fill).
Some characters in Excel are reserved for service. For example, if the search text starts at = , + , @ , the text will be perceived as a formula, a function. In order to avoid misunderstandings, the B2 cell format should be set as text.
' ----------------- Conditional formatting loads the file, if there are many conditions in the UV, it is possible to slow down when data changes. You can make it easier with VBA (macro).
Easy to use.
Alt + F11 - log in to the VBA editor
Insert-Module tab - creating a common module.
Expand the module and place the code shown below.
On the sheet, you can create a button (for example, Insert-Shapes ), which assign the launch of the macro ( RMB-Assign_Macros ).
' Π·Π°Π»ΠΈΠ²ΠΊΠ° ΡΡΠ΅Π΅ΠΊ ΡΡΠΎΠ»Π±ΡΠ° Π, ΡΠΎΠ΄Π΅ΡΠΆΠ°ΡΠΈΡ
ΠΈΡΠΊΠΎΠΌΡΠΉ ΡΡΠ°Π³ΠΌΠ΅Π½Ρ (ΡΡΠ΅ΠΉΠΊa Π2) Sub SearchOfText() Dim ArrData() Dim rRng As Range Dim sStr As String Dim lRws As Long, i As Long With ActiveSheet lRws = .Cells(.Rows.Count, "A").End(xlUp).Row ' ΠΏΠΎΡΠ»Π΅Π΄Π½ΡΡ Π·Π°ΠΏΠΎΠ»Π½Π΅Π½Π½Π°Ρ ΡΡΠ΅ΠΉΠΊΠ° If lRws < 2 Then Exit Sub ' Π΄Π°Π½Π½ΡΡ
Π½Π΅Ρ (ΠΏΠ΅ΡΠ²Π°Ρ ΡΡΡΠΎΠΊΠ° - ΡΠ°ΠΏΠΊΠ° ΡΠ°Π±Π»ΠΈΡΡ) ArrData = Range("A1:A" & lRws).Value ' Π·Π½Π°ΡΠ΅Π½ΠΈΡ ΡΡΠΎΠ»Π±ΡΠ° Π Π² ΠΌΠ°ΡΡΠΈΠ² sStr = .Range("B2").Value ' ΠΈΡΠΊΠΎΠΌΡΠΉ ΡΡΠ°Π³ΠΌΠ΅Π½Ρ Π² ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ For i = 2 To lRws ' ΡΠΈΠΊΠ»ΠΎΠΌ ΠΏΠΎ ΠΌΠ°ΡΡΠΈΠ²Ρ If ArrData(i, 1) Like "*" & sStr & "*" Then ' ΠΈΡΠΊΠΎΠΌΡΠΉ ΡΡΠ°Π³ΠΌΠ΅Π½Ρ Π² ΡΠ΅ΠΊΡΡΠ΅ Π΅ΡΡΡ If rRng Is Nothing Then Set rRng = .Cells(i, 1) ' ΡΠΎΡΠΌΠΈΡΡΠ΅ΠΌ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ Else Set rRng = Union(rRng, .Cells(i, 1)) 'ΠΏΠΎΠΏΠΎΠ»Π½ΡΠ΅ΠΌ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ End If End If Next i Application.ScreenUpdating = False ' ΠΎΡΠΊΠ»ΡΡΠ°Π΅ΠΌ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΡΠΊΡΠ°Π½Π° .Range("A2:A" & lRws).Interior.Pattern = xlNone ' ΡΠ΄Π°Π»Π΅Π½ΠΈΠ΅ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠ΅ΠΉ Π·Π°Π»ΠΈΠ²ΠΊΠΈ If Not rRng Is Nothing Then rRng.Interior.ColorIndex = 6 ' ΠΊΡΠ°ΡΠΈΠΌ Π΄ΠΈΠ°ΠΏΠ°Π·ΠΎΠ½ Application.ScreenUpdating = True ' Π²ΠΊΠ»ΡΡΠ°Π΅ΠΌ ΠΎΠ±Π½ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΡΠΊΡΠ°Π½Π° End With Set rRng = Nothing ' ΠΎΡΠ²ΠΎΠ±ΠΎΠΆΠ΄Π°Π΅ΠΌ ΠΏΠ°ΠΌΡΡΡ End Sub - thank! @vikttur - Patrick
- To add a macro to the collection? ) - vikttur
- : D: D thanks, but I donβt know how to use them :) - Patrick