Stop searching. Start learning and developing your excel skills.
Macro
VBA
Formula
Function
Shortcut
Tricks

» » VBA To Select Last Columns

VBA To Select Last Columns

June 03, 2017 |
This is also related to below queries:
  1. columns.count vba
  2. select last row vba
  3. excel vba last used column
  4. vba find last row with data
  5. excel vba find last row with data in range
The code:
''' Select last column
Range("A1").Select
    Selection.End(xlToRight).Select
    Range(ActiveCell, ActiveCell.Offset(0, 0)).EntireColumn.Select
''' Select last 2 columns
Range("A1").Select
    Selection.End(xlToRight).Select
    Range(ActiveCell, ActiveCell.Offset(0, -1)).EntireColumn.Select
''' Select last 3 columns
Range("A1").Select
    Selection.End(xlToRight).Select
    Range(ActiveCell, ActiveCell.Offset(0, -2)).EntireColumn.Select

No comments:

Post a Comment