Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi, I was wondering what command(s) would be best for finding a value's row and returning it as an integer? Thanks! Merritts -- merritts ------------------------------------------------------------------------ merritts's Profile: http://www.excelforum.com/member.php...o&userid=35803 View this thread: http://www.excelforum.com/showthread...hreadid=564512 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Merritts, There are a few ways to do this... Code: -------------------- 1) Using the Active Cell R = ActiveCell.Row 2) Using a Range to find the First Row R = Range("A2") 'R = 2 R = Range("A34:Z1250") 'R = 34, the first row in the range 3) Using a Range to find the Last Row With Worksheets("Sheet1") 'R = last non blank cell in column A on Worksheet1 R = .Cells(.Rows.Count, "A").End(xlUp).Row End With -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=564512 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could also use the Find method
For example, to search Sheet1 for the word "Test": Sub test() Const strCriteria = "Test" Dim rngCell As Range With Worksheets("Sheet1") Set rngCell = .Cells.Find(What:=strCriteria, _ After:=.Cells(1, 1), LookIn:=xlValues, _ LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) End With If Not rngCell Is Nothing Then _ MsgBox rngCell.Row End Sub Check VBA help for more information as you may need to change some of the search parameters. "merritts" wrote: Hi, I was wondering what command(s) would be best for finding a value's row and returning it as an integer? Thanks! Merritts -- merritts ------------------------------------------------------------------------ merritts's Profile: http://www.excelforum.com/member.php...o&userid=35803 View this thread: http://www.excelforum.com/showthread...hreadid=564512 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding a value and returning corresponding info | Excel Discussion (Misc queries) | |||
Finding a Name on a list and returning all matching rows | Excel Worksheet Functions | |||
Finding a cell and returning value from a different row and column | Excel Discussion (Misc queries) | |||
Finding an item in a list & returning a specific value | Excel Worksheet Functions | |||
Finding, and returning data. | New Users to Excel |