excel - Error when select multiple cells and press delete/backspace -
i have following code. stuff when [g,g,y,y,r,r] pressed , there error handling in case other keys pressed well. works fine! however, when multiple cells in column 11 selected , delete/backspace pressed "run-time error '13': type mismatch". private sub worksheet_change(byval target range) dim testcell dim re object dim rematches object dim cell1_1 string dim today string dim cell string thisrow = target.row 'action happens when typing [g,g,y,y,r,r] if target.column = 11 set re = createobject("vbscript.regexp") re .multiline = false .global = false .ignorecase = true .pattern = "[g,g,y,y,r,r]" end each testcell in target.cells set rematches = re.execute(testcell.value) if rematches.count > 0 , len(target.value) = 1 if len(cells(1, 1).value) = 1 today = now() cell1_1 = sheets("input").cells(1, 1).value range("l" & thisrow) = cell1_1 + ": " + format(toda...