Consulting

Results 1 to 4 of 4

Thread: Using End(xlToLeft) in Sheets with Tables

  1. #1
    VBAX Expert
    Joined
    Feb 2010
    Posts
    678
    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
    377
    Location
    Hi Opv!
    A simple example, Please refer to the attachment.
    Attached Files Attached Files

  3. #3
    Knowledge Base Approver VBAX Guru
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    4,506
    try:
    Set xx = ActiveCell.End(xlToLeft)
    If Not xx.ListObject Is Nothing And IsEmpty(xx) Then Set xx = xx.End(xlToLeft)
    xx.Select
    p45cal - - - - -This is my signature, it appears after all my posts. Below is not directed at anyone in particular - so don't take offence! - (You might guess why it's there though)
    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
    678
    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
  •