Farblich Markieren nach Datum per Powershell
Hallo Leute,
vielleicht kann mir jemand helfen.
Ich würde sehr gerne das aktuelle Datum in Grün.
Was 1 - 2 Tage zurück liegt in Gelb
und länger als 3 Tage zurück liegt in Rot.
weiß nicht ob es euch hilft, aber habe leider nur was wo mir die zahlen angezeigt werden und weiß nicht wie ich es mit Datum umändern kann.
Brauche es auch für Powershell.
mfg
vielleicht kann mir jemand helfen.
Ich würde sehr gerne das aktuelle Datum in Grün.
Was 1 - 2 Tage zurück liegt in Gelb
und länger als 3 Tage zurück liegt in Rot.
$condition = $ws.Range("K:K").FormatConditions.Add(1,3,100)
$condition.Interior.Color = 65280 #Grün
$condition = $ws.Range("K:K").FormatConditions.Add(1,7,50)
$condition.Interior.Color = 65535 #Gelb
$condition = $ws.Range("K:K").FormatConditions.Add(1,6,50)
$condition.Interior.Color = 255 #Rot
weiß nicht ob es euch hilft, aber habe leider nur was wo mir die zahlen angezeigt werden und weiß nicht wie ich es mit Datum umändern kann.
Brauche es auch für Powershell.
mfg
Please also mark the comments that contributed to the solution of the article
Content-Key: 327689
Url: https://administrator.de/contentid/327689
Printed on: April 26, 2024 at 08:04 o'clock
2 Comments
Latest comment
Servus,
mach die Formatbedingungen basierend auf einer Formel:
Grüße Uwe
mach die Formatbedingungen basierend auf einer Formel:
$quelle = "C:\Daten\Mappe.xlsx"
$objExcel = New-Object -Com Excel.Application
$wb = $objExcel.Workbooks.Open($quelle)
$objExcel.Visible = $true
$n = [System.Reflection.Missing]::Value
# Range der Formatiert werden soll
$rng = $wb.Sheets.Item(1).Range("K:K")
# Bedingte Formatierungen anwenden
$f = $rng.FormatConditions.Add(2, $n,"=K1=HEUTE()")
$f.Interior.Color = [System.Drawing.Color]::Green
$f = $rng.FormatConditions.Add(2, $n,"=K1>=HEUTE()-3")
$f.Interior.Color = [System.Drawing.Color]::Yellow
$f = $rng.FormatConditions.Add(2, $n,"=K1<HEUTE()-3")
$f.Interior.Color = [System.Drawing.Color]::Red