Which row am i?

kapfrank

Board Regular
Joined
Nov 16, 2005
Messages
112
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: :rolleyes: :wink:
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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
 
Upvote 0
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
 
Upvote 0
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>
        MsgBox "Was not found!"
    <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
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top