target.offset(0,-1) does not work as assumed

G

Guest

Hi all,

if cell a1 and b1 are merged and c1 and d1 are merged. if target = c1, then
target.offset(0,-1) refer to b1 not a1 and b1 merged area. How can I do it?

Clara
 
B

Bernie Deitrick

Clara,

Target.Offset(0, -1).MergeArea.Cells(1, 1).Value

HTH,
Bernie
MS Excel MVP
 
G

Guest

Hi Bernie,

Let's go further, if A1 And B1 , c1 ANd D1, E1 And F1 are merged seperately,
then target is on E1 And F1 mearged area, could you using
target.offset(0,-1).offset(0,-1) to refer to A1 and B1 area ?

Clara
 
B

Bernie Deitrick

Clara,

Target.Offset(0, -1).MergeArea.Cells(1, 1).Offset(0, -1).MergeArea.Cells(1,
1).Value

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top