# Which row am i?

#### kapfrank

##### Board Regular
Is it possible that if my active cell is F12.
I can work with number of the row, in this example number 12.

I need that number so i can work in other sheets with this number.
:wink: :wink:

### Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

#### Smitty

##### Legend
Welcome to the Board!

You can use =ROW() to get a row's number.

For any more detailed help, you'd need to popst back with more specific information as to what you're trying to accomplish.

Hope that helps,

Smitty

#### kapfrank

##### Board Regular
Thank you, this was the function that i was looking for.

#### kapfrank

##### Board Regular
I've made a macro but it isn't working.
Could somebody help me.

Dim k As String
Dim l As Variant

Do
k = ""
k = Application.InputBox("Van welke persoon wilt u een overzicht", "overzicht", Type:=2)
Loop While k = ""

Columns("E:E").Select
Selection.Find(What:=k, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate 'with this line i find a name in a colum'

'Now i want to know the row number, for example it is 12'

l = row() 'i think this is wrong, but i don't know what!'

'because i want to use that number in an other sheet'

Range("B" & l).Select

#### Guentjo

##### Active Member

try
Code:
``l= ActiveCell.row``

#### Zack Barresse

##### MrExcel MVP
Hey, maybe an adaptation such as ...

<font face=Tahoma New><SPAN style="color:#00007F">Sub</SPAN> TestMePlz()
<SPAN style="color:#00007F">Dim</SPAN> rngFind <SPAN style="color:#00007F">As</SPAN> Range
<SPAN style="color:#00007F">Dim</SPAN> kStr <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> iRow <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN>

<SPAN style="color:#00007F">Do</SPAN>
kStr = Application.InputBox("Van welke persoon wilt u een overzicht", "overzicht", Type:=2)
<SPAN style="color:#00007F">If</SPAN> kStr = "False" <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">Loop</SPAN> <SPAN style="color:#00007F">While</SPAN> kStr = ""

<SPAN style="color:#00007F">Set</SPAN> rngFind = Columns("E:E").Find(What:=kStr, After:=Range("E1"), _
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)

<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> rngFind <SPAN style="color:#00007F">Is</SPAN> <SPAN style="color:#00007F">Nothing</SPAN> <SPAN style="color:#00007F">Then</SPAN>
iRow = rngFind.Row
Range("B" & iRow).Select
<SPAN style="color:#00007F">Else</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>

<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

In VBA, getting the row is a little different. You must have some sort of worksheet object to return the row from. If it's not valid then it won't work. In the code you posted, Activecell.Row would have sufficed for the row number, but you don't need all that selecting and activating going on.

HTH

#### kapfrank

##### Board Regular
Thank You!
It's working now.

Replies
7
Views
424
Replies
6
Views
193
Replies
2
Views
216
Replies
24
Views
391
Replies
3
Views
269

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,163,621
Messages
5,832,735
Members
430,160
Latest member
a_majda

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back