How to find cell value based on row and Column ID in excel VBA

后端 未结 2 1983
故里飘歌
故里飘歌 2021-01-24 19:35

Need a VBA Sub to find a cell value based on Row and Column ID. In the example below I need to select the value where East and RT3 intersect which is 80.

    A   B            


        
2条回答
  •  难免孤独
    2021-01-24 19:50

    There are different ways to do this, but one approach is to use a function with parameters. You didn't say how you intent to pass the parameters, so I just used a sub to call the function.

    Function GetValue(row As Integer, col As Integer)
        GetValue = ActiveSheet.Cells(row, col)
    End Function
    
    Sub CallGetValue()
        Dim cellval As String
        cellval = GetValue(row:=4, col:=4)
        MsgBox (cellval)
    End Sub
    

提交回复
热议问题