This would seem to be an ideal time when Selection can provide the information you require.
sub FirstLastFull()
with selection
debug.print "first cell is: " & .cells(1, 1).address(0,0)
debug.print "last cell is: " & .cells(.rows.count, .columns.count).address(0,0)
debug.print "full range is: " & .address(0,0)
end with
end sub
The above will work on a contiguous range of selected cells. If you want the same information from a non-contiguous range, the Areas property must be considered.
sub FirstLastFull()
with selection
debug.print "first cell is: " & .cells(1, 1).address(0,0)
with .areas(.areas.count)
debug.print "last cell is: " & .cells(.rows.count, .columns.count).address(0,0)
end with
debug.print "full range is: " & .address(0,0)
end with
end sub
No comments:
Post a Comment