excel - Differentiating between hyperlinks in the code of hyperlink handler -


how reference specific hyperlinks named delete , not others have different names in following code:

private sub workbook_sheetfollowhyperlink(byval sh object, byval target hyperlink) range(activecell.address).name = "delete"  msgbox ("activated - workbook_sheetfollowhyperlink - before if-else")  if range(activecell.addresslocal).text = "delete"      clearthatcell 'calling clearthatcell sub  else  msgbox ("it's regular link - not delete ") end if   end sub 'this sub clearing selected cell sub clearthatcell() activecell.clear  msgbox ("the cell cleared!")  end sub  sub workbook_sheetdeactivate(byval sh object)         lastsheet = sh.name end sub 

the above code handler of hyperlinks, want code used if "delete" hyperlink clicked in parent workbook. tries help!

i'm guessing not matter worksheet's event initiates workbook_sheetfollowhyperlink event macro.

private sub workbook_sheetfollowhyperlink(byval sh object, byval target hyperlink)      if lcase(target.name) = "delete"         clearthatcell sh, target.range 'calling clearthatcell sub     end if  end sub  sub clearthatcell(ws worksheet, rng range)     msgbox "the " & rng.address(0, 0) & " cell on " & ws.name & " clicked." end sub 

check docs hyperlink object , hyperlink members see else can hyperlink.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -