Piyush Narkhede
Piyush Narkhede

Reputation: 87

Use Cell Address to Get Cell's Value

Sub selectRange()
    Dim A As String
    A = ActiveCell.Address
     MsgBox A
     MsgBox Cells(A)
End Sub

When I pass A as a parameter it shows error how should i pass values in parameter for current cell's data.

Upvotes: 4

Views: 25089

Answers (1)

Chrismas007
Chrismas007

Reputation: 6105

The proper syntax for Cells() is:

Cells([row number], [column number]).Value

To use the cell's address, use Range() instead:

Range([Address Range]).Value
Range(A).Value 'in your example

Upvotes: 11

Related Questions