Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA: how do I return a row number?


-Thanks Ron, its a great clue for me.-

Let me expand a little:

Now I want to know the row number of a given row. What Im doing i
searching customer records for a specific Social Security Number. Onc
I find the customer number, want to know what row that social securit
number is in so I can select the range and delete or update th
customer record.

Any suggestions?

_My_Code:_
Dim rng As Range

With Worksheets(1)
Set rng = .Columns(6).Find(txtCustSSN.Text)

If Not rng Is Nothing Then
'Populate frmCustLookup with Customer Information
txtLname.value = .Cells(rng.Row, 3).Value
txtFname.value = .Cells(rng.Row, 4).Value
txtMname.value = .Cells(rng.Row, 5).Value

Else: MsgBox "Customer Data Not Found"

End If

End With

End Sub


Thanks again for any advice

--
Mcastee
-----------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...fo&userid=1569
View this thread: http://www.excelforum.com/showthread.php?threadid=27430

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default how do I return a row number?

You have it in your code

rng.row = the row with the Social Security Number

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Mcasteel" wrote in message ...

-Thanks Ron, its a great clue for me.-

Let me expand a little:

Now I want to know the row number of a given row. What Im doing is
searching customer records for a specific Social Security Number. Once
I find the customer number, want to know what row that social security
number is in so I can select the range and delete or update the
customer record.

Any suggestions?

_My_Code:_
Dim rng As Range

With Worksheets(1)
Set rng = .Columns(6).Find(txtCustSSN.Text)

If Not rng Is Nothing Then
'Populate frmCustLookup with Customer Information
txtLname.value = .Cells(rng.Row, 3).Value
txtFname.value = .Cells(rng.Row, 4).Value
txtMname.value = .Cells(rng.Row, 5).Value

Else: MsgBox "Customer Data Not Found"

End If

End With

End Sub


Thanks again for any advice.


--
Mcasteel
------------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...o&userid=15698
View this thread: http://www.excelforum.com/showthread...hreadid=274302



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return Number George Excel Discussion (Misc queries) 2 March 3rd 09 05:49 PM
Return the Row number Kenneth Excel Discussion (Misc queries) 3 November 19th 08 08:45 AM
VBA: how do I return a row number? Mcasteel[_22_] Excel Programming 2 November 1st 04 10:44 PM
return row number Jonathan Vickers Excel Programming 3 February 22nd 04 12:18 AM
command to return the row number or cell number in excel? desmondleow[_5_] Excel Programming 1 December 11th 03 10:51 AM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"