excel vba getting the row,cell value from selection.address

后端 未结 2 814
一整个雨季
一整个雨季 2021-02-19 15:58
For i = 1 To 20

  \'\' select the cell in question
  Cells.Find(...).Select

  \'\' get the cell address

  CellAddr = Selection.Address(False, False, xlR1C1) 



Next
         


        
2条回答
  •  Happy的楠姐
    2021-02-19 16:16

    Is this what you are looking for ?

    Sub getRowCol()
    
        Range("A1").Select ' example
    
        Dim col, row
        col = Split(Selection.Address, "$")(1)
        row = Split(Selection.Address, "$")(2)
    
        MsgBox "Column is : " & col
        MsgBox "Row is : " & row
    
    End Sub
    

提交回复
热议问题