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: LaraTaner
 | Femeie 24 ani Prahova cauta Barbat 24 - 52 ani |
|
|
TRaP
Moderator
Inregistrat: acum 7 ani
Postari: 875
|
|
VBA - with prompt yes/no; if yes, applies to range hardcoded inside VBA script // if no, it applies to any selected range
Sub Highlight_Blank_Cells() Dim rng As Range Message = MsgBox("Vrei sa aplici highlight pe range in fisierul" & vbCrLf & _ "de colectare date pentru ........?", vbYesNo) If Message = vbYes Then Set rng = Range("E183:P186,E188:P190,E192:P195,E197:P200") ElseIf Message = vbNo Then Set rng = Selection End If
' Remove existing CF if you want (optional) ' rng.FormatConditions.Delete
rng.FormatConditions.Add _ Type:=xlExpression, _ Formula1:="=LEN(TRIM(" & rng.Cells(1, 1).Address(False, False) & "))=0" 'rng.FormatConditions(Selection.FormatConditions.count).SetFirstPriority With rng.FormatConditions(1).Interior .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorAccent2 .TintAndShade = 0.799981688894314 End With rng.FormatConditions(1).StopIfTrue = False End Sub |
Office Scripts - without prompt, applies to given ranges only
function main(workbook: ExcelScript.Workbook) { const sheet = workbook.getActiveWorksheet();
const ranges: string[] = [ "E183:P186", "E188:P190", "E192:P195", "E197:P200" ];
ranges.forEach((address) => { const rng: ExcelScript.Range = sheet.getRange(address);
const firstCellAddress = rng .getCell(0, 0) .getAddress() .split("!")[1];
const cf: ExcelScript.ConditionalFormat = rng.addConditionalFormat( ExcelScript.ConditionalFormatType.custom );
cf.getCustom().getRule().setFormula( `=LEN(TRIM(${firstCellAddress}))=0` );
const fill: ExcelScript.ConditionalRangeFill = cf.getCustom().getFormat().getFill();
fill.setColor("#FEF9D8"); // light yellow }); } |
Office Scripts - applies to any selected range
function main(workbook: ExcelScript.Workbook) { const sheet = workbook.getActiveWorksheet();
const selection = workbook.getSelectedRange();
// Handle multi-area selections safely const areas = selection.getAreas();
areas.forEach((rng: ExcelScript.Range) => { const firstCellAddress = rng .getCell(0, 0) .getAddress() .split("!")[1];
const cf: ExcelScript.ConditionalFormat = rng.addConditionalFormat( ExcelScript.ConditionalFormatType.custom );
cf.getCustom().getRule().setFormula( `=LEN(TRIM(${firstCellAddress}))=0` );
const fill: ExcelScript.ConditionalRangeFill = cf.getCustom().getFormat().getFill();
// Accent color (RGB – CF compatible) fill.setColor("#FEF9D8"); }); } |
|
|
| pus acum 11 zile |
|