Old VBA for a "check box" not working in excel 2016

richard11153

New Member
Joined
Feb 1, 2017
Messages
4
I have a workbook with VBA that was made years ago with Excel 2003. (see VBA below)
The sheets have many cells throughout that I can "Check off" with a click, to put an "X" in the cell.
(Each column has a hidden column next to it and when there is a "q" in it, the cell to the right will
put an "X" when clicked on)

I am now making an updated workbook with Excel 2016 and for some reason this VBA code
will not work. Can anyone shed some light on this, or is there a better VBA code type?
Thanks
----------------------------------------------

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]{Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "a1:bu1450" '<=== change to suit
If ActiveCell.Offset(0, -1).Value <> "q" Then
Exit Sub
End If
On Error GoTo err_handler
Application.EnableEvents = False
If Not Application.Intersect(Target, Range(WS_RANGE)) Is Nothing Then
With Target
.Font.Name = "x"
Select Case .Value
Case "x": .Value = ""
Case Else: .Value = "x"

End Select
.Offset(0, -1).Select
End With
End If
err_handler:
Application.EnableEvents = True
End Sub}
[/FONT]
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,089,434
Messages
5,408,195
Members
403,188
Latest member
Sanjana Ramesh

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top