Excell Färben

  • Servus,

    mal wieder ne doofe frage...

    Gibt es ne möglichkeit die Farbe einer zelle in excel zu färben? Habe leider nichts gefunden =(

    Einmal editiert, zuletzt von Koffein (3. Juli 2012 um 12:31)

  • http://www.autoitscript.com/forum/topic/10…ll/#entry751325


    Spoiler anzeigen
    [autoit]

    $oExcel = ObjCreate("Excel.Application")
    With $oExcel ; open new workbook
    .Visible = True
    .WorkBooks.Add
    .ActiveWorkbook.Sheets(1).Select()
    EndWith

    [/autoit] [autoit][/autoit] [autoit]

    $sRange ="A1:G8"
    $k = 1
    For $i = 1 To 7
    For $j = 1 To 8
    $oExcel.ActiveSheet.Range(Chr(64 + $i) & $j).Value = "ColorIndex: " & $k
    With $oExcel.ActiveSheet.Range(Chr(64 + $i) & $j).Font
    If Mod($j, 2) Then
    .Name = "Courier New"
    .FontStyle = "Italic"
    ;.Underline = 2
    Else
    .Name = "Comic Sans MS"
    .FontStyle = "Regular"
    .Underline = -4119 ; double underline
    ;.Underline = 4 ; accounting single underline
    ;.Underline = 5 ; accounting double underline
    EndIf
    .Bold = True
    .ColorIndex = $k
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    EndWith
    $k += 1
    Next
    Next
    ; format cells
    With $oExcel.ActiveSheet.Range($sRange)
    .Select
    .HorizontalAlignment = -4108 ; center
    .ColumnWidth = 18
    ;.EntireColumn.AutoFit
    EndWith
    ; color columns
    For $i = 1 To 7
    $sCol = Chr(64 + $i)
    If Mod($i, 2) Then
    $oExcel.ActiveSheet.Range($sCol & "1:" & $sCol & "8").Interior.ColorIndex = 3
    Else
    $oExcel.ActiveSheet.Range($sCol & "1:" & $sCol & "8").Interior.ColorIndex = 20
    EndIf
    Next

    [/autoit]
  • auch wenn schon gelöst!

    folgend nochmal paar beispiele ...

    [autoit]


    $oExcel.Columns("A1:C1").ColumnWidth = "50" ;setze spaltenbreite
    $oExcel.Range("A1:C1") .Font.Bold = TRUE ; setze schriftgrad
    $oExcel.Range("A1:C1") .Font.Size = 14 ; setze schriftgröße
    $oExcel.Range("A1:C1") .Font.Color = 0xffffff
    $oExcel.Range("A1:C1") .Interior.ColorIndex = 43 ; setze Farbe

    [/autoit]

    gruß gmmg