返回列表 上一主題 發帖

[發問] EXCEL VBA選取部分儲存格範圍-(指定儲存格向下及向右至邊界處)

回復 1# junkwei

試試看!!
  1. Sub test()

  2.     last_rows = Selection.SpecialCells(xlCellTypeLastCell).Row
  3.     last_columns = Selection.SpecialCells(xlCellTypeLastCell).Column

  4.     Set table_array = Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(last_rows, last_columns))
  5.     MsgBox table_array(3, 2)
  6. End Sub
複製代碼

TOP

本帖最後由 ashan0418 於 2014-12-28 19:55 編輯

回復 3# junkwei

你是指要從C2開始並向下及向右指定所有資料的Range嗎??

若是將
Set table_array = Range(Cells(ActiveCell.Row, ActiveCell.Column), Cells(last_rows, last_columns))

改成
Set table_array = Range(Cells(3,2), Cells(last_rows, last_columns))

TOP

        靜思自在 : 對父母要知恩,感恩、報恩。
返回列表 上一主題