so using several counters go through sheet , check values left , right of cell. when message box shown, shows:
right cell column: 14
current cell column: 8
left cell column: 7
in other words, left cell 1 column left, should be. right cell 6 columns right! used 1 column shift, , tried doing using variable name, subtraction, , columnoffset:= prefix. googled how offset function used, found nothing related problem one.
here code:
msgbox "right cell column: " & activesheet.cells(2, currcount2 - 1).offset(treecount - 1, 1).column & vbnewline & "current cell column: " & activesheet.cells(2, currcount2 - 1).offset(treecount - 1, 0).column & vbnewline & "left cell column: " & activesheet.cells(2, currcount2 - 1).offset(treecount - 1, -1).column
okay, posting answer because searching might want find solution. problem merged cells. before run code this, check merged cells, case, be:
if activesheet.cells(2, currcount2 - 1).offset(treecount - 1, 1).mergecells
and want find first value in mergearea instead:
activesheet.cells(2, currcount2 - 1).offset(treecount - 1, 1).mergearea.cells(1, 1).value
hope helps out there! :)
Comments
Post a Comment