Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 109
Default Loop through last cell/row of used range

How to write code for this:
Find last cell of Col A of w/sheet used range and match a value of of
userform.textbox1 , loop from last row to first row of used range,if match
found fetch Col B value to userform.textbox2.
Say my usedrange is A1:C123,goto A123 ,match "Xyz"(textbox1 value) loop
through A123 to A1 ,find match.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 248
Default Loop through last cell/row of used range

Use
'Make sure that userform.textbox1 is the correct way to get the value in
textbox1

Sub fetch()
For i = Right(ActiveSheet.UsedRange.Address, 2) To 1 Step -1
If Cells(i, 1) = userform.textbox1 Then
userform.textbox2 = Cells(i, 2)
Exit Sub userform.textbox1 & " Not found."
Next i
Msgbox
End Sub
-------------------------------------
Pl. click ''Yes'' if this was helpful...



"tkraju via OfficeKB.com" wrote:

How to write code for this:
Find last cell of Col A of w/sheet used range and match a value of of
userform.textbox1 , loop from last row to first row of used range,if match
found fetch Col B value to userform.textbox2.
Say my usedrange is A1:C123,goto A123 ,match "Xyz"(textbox1 value) loop
through A123 to A1 ,find match.

--
Message posted via http://www.officekb.com


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
loop code on cell range Otto Excel Discussion (Misc queries) 1 July 3rd 08 02:35 PM
Loop QUESTION to end of data range... mniccole Excel Worksheet Functions 2 December 4th 06 09:25 PM
Loop QUESTION to end of data range... mniccole Excel Worksheet Functions 2 December 4th 06 05:19 PM
Loop QUESTION to end of data range... mniccole Excel Worksheet Functions 0 December 4th 06 03:59 PM
How do I loop a range of cells until I get a numeric value? ManKind New Users to Excel 1 June 4th 06 06:48 AM


All times are GMT +1. The time now is 12:35 PM.

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

About Us

"It's about Microsoft Excel"