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

» » VBA To Select Until Last Column in Blank Row

VBA To Select Until Last Column in Blank Row

August 09, 2018 |
Say in a blank row, you want to select from selected cell until last column. If you use ctrl + shift + > key, excel will bring you until the end of excel (column XFD in excel 2016). So the easiest way is by identifying last column with header and then use a macro to select until the last column.

Say your header is in row #4, and you want to select from cell BE1 until last column with data in the same row:

Dim k as long
With ActiveSheet
   k = .Cells(4, .Columns.Count).End(xlToLeft).Column
End With
Range(Range("BE1"), Cells(1, k)).Select

No comments:

Post a Comment