ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Store row number after a find (https://www.excelbanter.com/excel-discussion-misc-queries/42235-store-row-number-after-find.html)

Alan

Store row number after a find
 
Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row

FSt1

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row


Alan

Hello,

Any column on that row. Real problem is storing the 'found' row number to a
variable

"FSt1" wrote:

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row


FSt1

hi,
if you are using the built in find then you do have a problem. try this...
Sub macfindrow()
dim rn as string
dim rng as range
dim therow as long

rn = inputbox("enter something to find")
if rn < "" then
Set rng = nothing
Set rng = range("A1:IV65536").Find(what:=rn, _
After:=Range("A1"), _
Lookin:=xlformulas, _
Lookat:=xlpart, _
SearchOrder:=xlbyrows, _
SearchDirection:=xlNext, _
MatchCase:=false)
end if
therow = rng.row
msgbox "Found at cell " & rng.address
msbbox "The row number is " & therow
end sub

therow is the variable

Regards
FSt1
"Alan" wrote:

Hello,

Any column on that row. Real problem is storing the 'found' row number to a
variable

"FSt1" wrote:

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row


Alan

Dear FSt1,

Thanks very good. I have modified slightly and now all is OK.

What does FSt1 mean or stand for ?

Alan

"FSt1" wrote:

hi,
if you are using the built in find then you do have a problem. try this...
Sub macfindrow()
dim rn as string
dim rng as range
dim therow as long

rn = inputbox("enter something to find")
if rn < "" then
Set rng = nothing
Set rng = range("A1:IV65536").Find(what:=rn, _
After:=Range("A1"), _
Lookin:=xlformulas, _
Lookat:=xlpart, _
SearchOrder:=xlbyrows, _
SearchDirection:=xlNext, _
MatchCase:=false)
end if
therow = rng.row
msgbox "Found at cell " & rng.address
msbbox "The row number is " & therow
end sub

therow is the variable

Regards
FSt1
"Alan" wrote:

Hello,

Any column on that row. Real problem is storing the 'found' row number to a
variable

"FSt1" wrote:

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row


FSt1

my name is Frank Stone
FStone
FSt one
how do you spell the number 1

Regards
FSt1

"Alan" wrote:

Dear FSt1,

Thanks very good. I have modified slightly and now all is OK.

What does FSt1 mean or stand for ?

Alan

"FSt1" wrote:

hi,
if you are using the built in find then you do have a problem. try this...
Sub macfindrow()
dim rn as string
dim rng as range
dim therow as long

rn = inputbox("enter something to find")
if rn < "" then
Set rng = nothing
Set rng = range("A1:IV65536").Find(what:=rn, _
After:=Range("A1"), _
Lookin:=xlformulas, _
Lookat:=xlpart, _
SearchOrder:=xlbyrows, _
SearchDirection:=xlNext, _
MatchCase:=false)
end if
therow = rng.row
msgbox "Found at cell " & rng.address
msbbox "The row number is " & therow
end sub

therow is the variable

Regards
FSt1
"Alan" wrote:

Hello,

Any column on that row. Real problem is storing the 'found' row number to a
variable

"FSt1" wrote:

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row


Alan

Frank,

Can you help with an embelishment to your solution. How can I trap a NO FIND
following the find command you supplied

"FSt1" wrote:

my name is Frank Stone
FStone
FSt one
how do you spell the number 1

Regards
FSt1

"Alan" wrote:

Dear FSt1,

Thanks very good. I have modified slightly and now all is OK.

What does FSt1 mean or stand for ?

Alan

"FSt1" wrote:

hi,
if you are using the built in find then you do have a problem. try this...
Sub macfindrow()
dim rn as string
dim rng as range
dim therow as long

rn = inputbox("enter something to find")
if rn < "" then
Set rng = nothing
Set rng = range("A1:IV65536").Find(what:=rn, _
After:=Range("A1"), _
Lookin:=xlformulas, _
Lookat:=xlpart, _
SearchOrder:=xlbyrows, _
SearchDirection:=xlNext, _
MatchCase:=false)
end if
therow = rng.row
msgbox "Found at cell " & rng.address
msbbox "The row number is " & therow
end sub

therow is the variable

Regards
FSt1
"Alan" wrote:

Hello,

Any column on that row. Real problem is storing the 'found' row number to a
variable

"FSt1" wrote:

hi,
what column? same column? different column?

Regards
FSt1

"Alan" wrote:

Following a find command I want to store the row number to a variablke and
use that to move to a columb on that row



All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com