Thursday, March 5, 2020

Mengenal KODE WARNA DGN VBA



Color Active Cell     
            Mewarnai Cell Active Dan Menormalkan Otomatis Dengan Run
Di Worksheet_Selectionchange

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
    Application.ScreenUpdating = False
Cells.Interior.ColorIndex = 0
        ActiveCell.Interior.ColorIndex = 4
    Application.ScreenUpdating = True '
End Sub         

Color Border Target          
            Target Border Activecell 

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim strRange As String
strRange = Target.Cells.Address & "," & _
Target.Cells.EntireColumn.Address & "," & _
Target.Cells.EntireRow.Address
Range(strRange).Select
End Sub

Color Copy Background   
            Copy Pastespecial Xlpasteformats Warna       


Sub BackGroundColour()
Range("a1:d1").Copy
Range("a3:d3").PasteSpecial xlPasteFormats
End Sub

Color Copy Only     
            Copy Paste Khusus Warna Copy Range("F1:F50") Ke Kolom C

Sub copycolors()
  Dim cell As Range, s As String
s = "C"
  For Each cell In Range("F1:F50")
    Range("C" & cell.Row).Interior.Color = cell.Interior.Color
  Next cell
End Sub         


Color Count
            Menghitung Cell Berwarna Tertentu
 Cara Pakainya  Misalnya    =Countbycolor ("A5")   

Function CountByColor(CellColor As Range, CountRange As Range)
Application.Volatile
Dim ICol As Integer
Dim TCell As Range
ICol = CellColor.Interior.ColorIndex
For Each TCell In CountRange
If ICol = TCell.Interior.ColorIndex Then
CountByColor = CountByColor + 1
End If
Next TCell
End Function


Color Front Kreteria         
                 Mewarnai Hurup Dengan Acuan Nilai Kreteria  Di Cells(I, 2) Atau Dikolom B        

Sub sampel ()
For i = 1 To 20
If Cells(i, 2).Value > 50 Then
Cells(i, 2).Font.ColorIndex = 5
Else
Cells(i, 2).Font.ColorIndex = 3
End If
Next i
End Sub



Color Indek
Menampilkan Semua Warna Dengan Kode Angka
           
For i = 1 To 56
Cells(i, 2).Interior.ColorIndex = i
Cells(i, 2) = i
Next i


Color Shape 
Mewarnai Shapes("Textbox 1") Activesheet

Sub warna()
With ActiveSheet
.Shapes("TextBox 1").Fill.ForeColor.RGB = vbWhite
.Shapes("TextBox 2").Fill.ForeColor.RGB = vbWhite
.Shapes("TextBox 3").Fill.ForeColor.RGB = vbWhite
End With
End Sub



No comments:

Post a Comment

APLIKASI GUDANG VERSI EXCEL VBA

Aplikasi Gudang Sederhana silahkan dikembangkan kritik dan saran membangun selalu kami harapkan FROM ENTRI IURAN BULANA...