VBA - Grupowanie kolorem
Wednesday, July 8th, 2009 | VBA
Sub grupuj_kolorem()
Dim row As Range
Dim target As Range
Dim x As Integer
Dim licznik As Integercol_number = Val(InputBox(”Podaj numer kolumny do grupowania”))
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).SelectFor Each row In Selection.Rows
Set target = row.Range(Cells(1, col_number), Cells(1, col_number))
If target.Value <> target.Offset(-1, 0).Value Then
x = Abs(x - 1)
licznik = licznik + 1
End If
If x = 0 Then
row.Interior.ColorIndex = 35
Else
row.Interior.ColorIndex = 37
End If
Next
MsgBox (”Liczba Grup: ” & licznik)
End Sub
1 Comment to VBA - Grupowanie kolorem
Sub autofill_down()
Dim rng As Range
Application.Calculation = xlCalculationManual
Set rng = ActiveSheet.Range(”definicje”)
For Each cell In rng.Cells
cell.Select
Range(Selection, Selection.End(xlDown).Offset(-1, 0)).Select
Selection.FillDown
Next
Application.Calculation = xlCalculationAutomatic
End Sub
January 13, 2010