MrHuge
Board Regular
- Joined
- Jun 23, 2005
- Messages
- 219
I have the current vb which works great.
I would like to change this, so that instead of naming the columns to be used in VB, I would like it to look at Row 1 and if it is equal to 1 then use this script.
ie in Row1 Column 5 i have a "1" value in the cell, then all cells in column 5 use the tick box vb.
I believe i could use an intersect command, but i am not sure on how to do it.
Any help would be appreciated.
Code:
'------------------------------------------------------
'- WORKSHEET CHECKBOX ALTERNATIVE
'- ADDS OR REMOVES TICK IN A CELL. Font = Wingdings.
'------------------------------------------------------
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, _
Cancel As Boolean)
Dim MyTick As String
Dim MyUnTick As String
MyTick = Chr(254)
MyUnTick = Chr(111)
TopRow = 4
BottomRow = 65536
'-
If (ActiveCell.Column = 5 Or (ActiveCell.Column > 6 And ActiveCell.Column < 13) Or (ActiveCell.Column > 17 And ActiveCell.Column < 38) Or ActiveCell.Column = 39 Or ActiveCell.Column = 41 Or ActiveCell.Column = 43 Or ActiveCell.Column = 45 Or (ActiveCell.Column > 46 And ActiveCell.Column < 51)) _
And ActiveCell.Row >= TopRow _
And ActiveCell.Row <= BottomRow Then
If ActiveCell = MyUnTick Then
ActiveCell.Font.Name = "Wingdings"
ActiveCell.Font.Size = 12
ActiveCell.Font.ColorIndex = 3
ActiveCell.Value = MyTick
Else
ActiveCell.Font.Name = "Wingdings"
ActiveCell.Font.Size = 12
ActiveCell.Font.ColorIndex = 1
ActiveCell.Value = MyUnTick
End If
ActiveCell.Offset(1, 0).Select
Else
End If
End Sub
'-------------------------------------------------------------------------
ie in Row1 Column 5 i have a "1" value in the cell, then all cells in column 5 use the tick box vb.
I believe i could use an intersect command, but i am not sure on how to do it.
Any help would be appreciated.