Private Sub Worksheet_SelectionChange(ByVal Target As Range) '可以直接sub(),不然选择就会触发vba
    Dim rows_count As Integer
    Dim rows_id As Integer
    Dim column_count As Integer
    Dim column_id As Integer
    column_count = Selection.Columns.Count '返回选择区域列数
    rows_id = ActiveCell.Row  '返回活动单元格的行号
    rows_count = Selection.Rows.Count  '返回选择区域的行数

    column_id = ActiveCell.Column  '返回活动单元格的列号
    MsgBox rows_count
    MsgBox column_count
    MsgBox column_id
    MsgBox rows_id
End Sub

 



相关文章:

  • 2021-04-01
  • 2021-12-10
  • 2021-11-30
  • 2021-12-09
  • 2021-08-11
  • 2021-07-09
猜你喜欢
  • 2021-09-25
  • 2021-11-30
  • 2021-08-29
  • 2021-09-17
  • 2021-12-11
  • 2022-12-23
  • 2021-12-12
相关资源
相似解决方案