excel - Efficient alternative to using Target.Address -
i'm using target.address identify when cell double clicked , run piece of code take user relevant sheet showing information contained in cell.
so example, if cell says 3 systems haven't done sort of action, if user clicks on cell taken 3 systems are.
currently, i'm doing so:
if target.address = "$b$20" win2ktrackerincompletefilter (strengunits(9)) elseif target.address = "$c$20" win2ktrackerincompletefilter (strengunits(0)) elseif target.address = "$d$20" win2ktrackerincompletefilter (strengunits(1)) etc
i've put majority of code in 1 small function, seems doing job okay. however, if insert new row above row 20 (from above example), of these references pointing wrong place. thought handle removing absolute references (the $ sign) breaks mechanism.
can advise how either a) rewrite code make more efficient , b) protect code new rows can inserted , code remember rows/columns pointing , update accordingly.
select cell on spreadsheet , give name
for example b3 named mycell
and edit script little use named ranges this
dim namedrange name if target.address = me.range("mycell").address win2ktrackerincompletefilter (strengunits(9)) elseif ... ... end if
so if insert new rows name update .refersto
property automatically , not have touch script.
Comments
Post a Comment