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:
Roxiii
Femeie
23 ani
Bucuresti
cauta Barbat
23 - 38 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Macro Color Code List, ColorIndex and RGB Usage [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TonyTzu
Moderator

Inregistrat: acum 12 ani
Postari: 252
Add colors to font, borders, shading in VBA using these codes:

Excel ColorIndex

1 = black
2 = white
3 = red
4 = green
5 = blue
6 = yellow
7 = magenta
8 = cyan
9 = brown
10 = dark green
16 = grey
38 = pink
46 = orange

Example 1: Set Cell A1 font color to red: Range("A1").Font.ColorIndex = 3

Example 2: Set Cell A1 back color to red: Range("A1").Interior.ColorIndex = 3

Example 3: Set Cell A1 border color to red: Range("A1").Borders.ColorIndex=3

Example 4: Get Cell A1 ColorIndex: col = Range("A1").Interior.ColorIndex

Using RGB colors

White = 255, 255, 255
Black = 0, 0, 0
Red = 255, 0, 0
Green = 0, 255, 0
Yellow = 255, 255, 0
Magenta = 255, 0, 255
Cyan = 0, 255, 255

Example 1: Set Cell A1 font color to red: Range("A1").Font.Color = RGB(255, 0, 0)

Example 2: Set Cell A1 back color to red: Range("A1").Interior.Color = RGB(255, 0, 0)

Example 3: Set Cell A1 border color to red: Range("A1").Borders.Color = RGB(255, 0, 0)

Using VB colors

vbBlack
vbWhite
vbBlue
vbCyan
vbGreen
vbMagenta
vbRed
vbYellow

Example: Set Cell A1 font color to red: Range("A1").Font.Color = vbRed

More info:


pus acum 6 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 739
Pinned.

Cuvinte cheie: colorindex color interior


pus acum 1 an
   
Pagini: 1  

Mergi la