I am trying to make a selection of an entire column except the first row . I used the following code which i got from https://www.extendoffice.com/documents/excel/1628-excel-select-column-except-header-first-row.html
Sub SelectColumn()
Dim xColIndex As Integer
Dim xRowIndex As Integer
xColIndex = Application.ActiveCell.Column
xRowIndex = Application.ActiveSheet.Cells(Rows.Count, xColIndex).End(xlUp).Row
Range(Cells(2, xColIndex), Cells(xRowIndex, xColIndex)).Select
End Sub
but the RowIndex variable reads to the value 1. So the section happens from Row2 to Row1 instead of Row2 to the Last row. How can i get this corrected
If you really need to select the whole column (why?) then this. In your example you can't have any data in the relevant column.
Range(Cells(2, xColIndex), Cells(rows.count, xColIndex)).Select
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.