PDA

View Full Version : [SOLVED:] Using End(xlToLeft) in Sheets with Tables



Opv
06-02-2019, 03:55 PM
Is there a way in VBA to force End(xlToLeft) to stop at the last data cell within a Table for a particular row when starting from a cell outside of the Table? At present End(xlToLeft) is stopping at the last column within the Table, even if it is empty. I am using Office 2007. Thanks.

大灰狼1976
06-02-2019, 08:01 PM
Hi Opv!
A simple example, Please refer to the attachment.

p45cal
06-03-2019, 06:35 AM
try:
Set xx = ActiveCell.End(xlToLeft)
If Not xx.ListObject Is Nothing And IsEmpty(xx) Then Set xx = xx.End(xlToLeft)
xx.Select

Opv
06-03-2019, 07:38 AM
Thanks to both of you for your solutions.