selection.MergeCells property changes the original selection in excel -
i want check if selection contains mergecells , if not want process selection in excel. whenever call selection.mergecells original selection changes , wraps areas bounded mergecells not want. have checked below msdn link, tell limitation/bug , can not solved , can please me?
http://social.msdn.microsoft.com/forums/en-us/exceldev/thread/63920347-c731-4046-b96f-3f3e7eabddd8
the problem in case different link point (because in selectionchanged event). in case, problem using selection.mergecells
in vba code. don't that.
you should avoid using select-related actions in own vba code (because slow , worse, has tons of unintended side-effects, this). instead, use range objects. because selection range closely bound selection object, may need disassociate it, so:
dim rng range, ws worksheet 'get current worksheet set ws = activesheet 'get selection-range set rng = selection 'get same range, disassociated selection '(i think works?) set rng = ws.range(rng.addresslocal) if rng.mergecells ...
let me know if not work (i cannot test right now), there more complicated approach can used intead.
Comments
Post a Comment