Excel - oznacz myszką wybrany wiersz

Thursday, June 4th, 2009 | VBA

Private Declare Function GetKeyState Lib “user32″ (ByVal nVirtKey As Long) As Integer
Private Const kCapital = 20
Private Const kNumlock = 144
Private Const TargetCol = 3

Public Function CapsLock() As Boolean
CapsLock = KeyState(kCapital)
End Function

Private Function KeyState(lKey As Long) As Boolean
KeyState = CBool(GetKeyState(lKey))
End Function
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If CapsLock Then
    For Each cell In Target.Cells
        x = ActiveSheet.Cells(cell.Row, TargetCol)
        x = Abs(x - 1)
        ActiveSheet.Cells(cell.Row, TargetCol).Value = x
    Next
End If
End Sub

Sub dodaj_formatowanie()
    Range(”A1:D31″).Select
    Selection.FormatConditions.Delete
    Selection.FormatConditions.Add Type:=xlExpression, Formula1:=”=$D1=1″
    Selection.FormatConditions(1).Interior.ColorIndex = 36
End Sub

Tags: ,

No comments yet.

Leave a comment

Search