【发布时间】:2018-07-06 03:05:48
【问题描述】:
代码:
Sub MyColumnSelect()
Dim myCurrentRow As Long
Dim myLastColumn As Long
myCurrentRow = ActiveCell.Row
myLastColumn = ActiveCell.SpecialCells(xlLastCell).Column
Range(ActiveCell, Cells(myCurrentRow, myLastColumn)).Select
End Sub
我需要将我的选择从任何列或任何行扩展到工作表中最后使用的列。此代码将选择扩展到特定列,在我的情况下为column P。我不知道为什么会这样,但即使只有 4 列,它仍然会将选择范围扩展到column P。
PS:我知道我不应该使用select,但即使使用select,我也无法让它工作。需要帮忙。
【问题讨论】:
-
使用 usedrange.columns.count.... 在这里您可以找到相关信息:stackoverflow.com/questions/21172108/…。