excel - ActiveSheet.Shapes(Application.Caller).TopLeftCell.Row returns wrong row -


i'm using small macro add , delete rows in protected worksheet. each line has "delete" button. when new line added, last existing line copied (including "delete" button) , content cleared.

for deleting rows hand on parameters including "delete" button's (and item's) row. use:

rowtodelete = activesheet.shapes(application.caller).topleftcell.row 

this code works fine existing lines, fail lines added since workbook last opened (except last one). other delete next line added instead of "real" one.

i guess cache problem, "application.caller" contains right string, returns row of copied shape no longer carries name.

is there way clear relevant cache or force shapes() not use cache?

thanks lot help.

i've found workaround i'm not happy has trick now. i'm using random shapenames avoid wrong return values. seems if shape name did not exist before lookup works.

shp.name = "shape" & format(i, "0000") & (rnd * 999) 

must cache problem, button work fine after saving , reopening workbook.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -