範例:依據目前工作表所選取的範圍,顯示所有列號
Private Sub PrintTSF(ByVal savePath As String)
Dim FB As Workbook: Set FB = ActiveWorkbook '目前活頁簿
Dim FS As Worksheet: Set FS = ActiveSheet '目前工作表
Dim xArea As Range
Dim i As Integer
Dim iRow As Integer
With FS
For Each xArea In Selection.Areas
For i = 1 To xArea.Rows.Count
iRow = xArea.Rows(i).Row '一筆筆取得選取的列號
MsgBox iRow
Next
Next xArea
End With
Set FB = Nothing
Set FS = Nothing
End Sub
0 意見:
張貼留言