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...finding location of number


I would like to know if this is possible:

I have the code asking user for a number
The number input is compared to a range of values on a previous sheet
If the number is 'valid' then i would like to know if there is a wa
for me to find out what row the matched up value is in?
THANK YOU!

here is the incomplete code:

Sub commandbutton1_click()

Dim rng As Range
Dim roundNumber As Integer
Dim matchNumber As Variant

roundNumber = InputBox("Enter the Round number for which you would lik
the summary ", "Round Number")

Set rng = Worksheets(1).Range("C4:C12")

matchNumber = Application.Match(roundNumber, rng, 0)
If Not IsError(matchnumber) Then
'want to find what row the matched number is on sheet 1

Else
MsgBox "That is not a valid Round number"
End If

End Su

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default vba...finding location of number

Try something like

If Not IsError(matchNumber) Then
MsgBox rng.Offset(matchNumber - 1, 1).Row
Else
MsgBox "That is not a valid Round number"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"chick-racer" wrote in message
...

I would like to know if this is possible:

I have the code asking user for a number
The number input is compared to a range of values on a previous sheet
If the number is 'valid' then i would like to know if there is a way
for me to find out what row the matched up value is in?
THANK YOU!

here is the incomplete code:

Sub commandbutton1_click()

Dim rng As Range
Dim roundNumber As Integer
Dim matchNumber As Variant

roundNumber = InputBox("Enter the Round number for which you would like
the summary ", "Round Number")

Set rng = Worksheets(1).Range("C4:C12")

matchNumber = Application.Match(roundNumber, rng, 0)
If Not IsError(matchnumber) Then
'want to find what row the matched number is on sheet 1

Else
MsgBox "That is not a valid Round number"
End If

End Sub


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.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
Finding a cell location Lucask New Users to Excel 3 February 26th 09 01:14 PM
Finding the Location within an Array Sh0t2bts Excel Worksheet Functions 2 December 5th 07 01:06 PM
Finding the location of what was summed [email protected] Excel Worksheet Functions 3 May 21st 07 08:15 PM
Finding the location of MAX value in column milly Excel Discussion (Misc queries) 2 May 11th 07 12:15 PM
finding cell location Jshendel Excel Discussion (Misc queries) 5 August 30th 06 10:02 PM


All times are GMT +1. The time now is 10:24 AM.

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"