PDA

View Full Version : Solved: How to capture position info of a cell



amhiddema
09-20-2009, 11:43 PM
Through a VBA code a cell is manuallu selected. I would like to capture the position of the selected cell into VBA as I'm trying to do in the code. I need the strings a and b to be filled. Unfortunately, it does not work. What am I doing wrong?

Sub Macro1()

Dim a As Integer, b As String, rRange As Range

Set rRange = Application.InputBox(Prompt:= _
"Please select a Cell", _
Title:="Select Cell", Type:=8)

SelectedCell = Cells(a, b)

End Sub

Bob Phillips
09-21-2009, 01:21 AM
What do you mean by capture the position of the cell? You already have the cell in a variable, rRange.

amhiddema
09-21-2009, 01:39 AM
What I mean is that I need the variables a and b in "Cells(a, b)". I want to be able to manually select a cell and then use "a" to go to the next row by using "a=a+1".

Bob Phillips
09-21-2009, 02:02 AM
a = rRange.Row
b = rRange.Column

amhiddema
09-21-2009, 02:56 AM
Thanks a lot!! I really start to like this forum!!!