View Full Version : Solved: VBA and Check Boxes
White_Nova
01-23-2008, 02:01 AM
Hi all
Wonder if you can shed some light on check boxes in excel with VBA?
I have a list of entries in excel that i would like to have sent to access depending on weather a box next to each is ticked or not...
so if enrty 1,3,5,7,9 is ticked take to access...
how would this look in VBA code?
Thanks
Bob Phillips
01-23-2008, 03:06 AM
I wouldn't use checkboxes.
This works by double-clicking in a cell, and toggles the check-mark.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Const WS_RANGE As String = "H1:H10" '<=== change to suit
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
With Target
.Font.Name = "Marlett"
Select Case .Value
Case "": .Value = "a"
Case "a": .Value = ""
End Select
End With
End If
err_handler:
Application.EnableEvents = True
End Sub
This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.
White_Nova
01-23-2008, 05:10 AM
Thanks a million!!!!!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.