Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Coco11 la Simpatie.ro
Femeie
25 ani
Constanta
cauta Barbat
27 - 65 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Insert Simple Conditional Formatting with Formula in Selection Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 787
I had to select a column of a table, go to Conditional Formatting - New Rule - Use formula to determine which cells to format, type: =$J8=0, go to Format, choose Fill, select No Color, click OK and again OK.

Instead of all that, I recorded me doing that, then edited the resulting macro to insert starting cell via Input Box and just click an OK once.

All I have to do now is 1. select desired cells 2. press macro button 3. write first cell in input box 4. press OK.

Note: the following code is simple with no fail-safe measures in case you don't type the cell properly - eg. you type only the letter without the number.


Sub Cond_Format_Selection_Formula()

Dim celula As String
    celula = InputBox("Introdu prima celula din Range, ex. J8")

Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$" & celula & "=0"   ' formula is =$J8=0
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
   
With Selection.FormatConditions(1).Interior
    .Pattern = xlNone
    .TintAndShade = 0
End With

Selection.FormatConditions(1).StopIfTrue = False

End Sub


pus acum 3 ani
   
Pagini: 1  

Mergi la