Consulting

Results 1 to 4 of 4

Thread: Using End(xlToLeft) in Sheets with Tables

  1. #1
    VBAX Expert
    Joined
    Feb 2010
    Posts
    696
    Location

    Using End(xlToLeft) in Sheets with Tables

    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.

  2. #2
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi Opv!
    A simple example, Please refer to the attachment.
    Attached Files Attached Files

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,844
    try:
    Set xx = ActiveCell.End(xlToLeft)
    If Not xx.ListObject Is Nothing And IsEmpty(xx) Then Set xx = xx.End(xlToLeft)
    xx.Select
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Expert
    Joined
    Feb 2010
    Posts
    696
    Location
    Thanks to both of you for your solutions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •