Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-29-2022, 06:48 AM
p45cal's Avatar
p45cal p45cal is offline Need help writing UDF to determine the Row number of a value Windows 10 Need help writing UDF to determine the Row number of a value Office 2019
Expert
 
Join Date: Apr 2014
Posts: 873
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Change your formula in cell B2 to say:


=matchrow(A2,$C$1:$N$10)
copy down if you want.
Put values you're looking for in column A next to the formulae.

Remove all the Dims at the top of the code-module.

Change your function to:
Code:
Function matchrow(x, interval)
Dim a As Range
Set a = interval.Find(x, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False, searchformat:=False)
If Not a Is Nothing Then matchrow = a.Row Else matchrow = "Not found"
End Function
Reply With Quote
  #2  
Old 07-29-2022, 08:07 PM
soroush.kalantari soroush.kalantari is offline Need help writing UDF to determine the Row number of a value Windows 10 Need help writing UDF to determine the Row number of a value Office 2016
Competent Performer
Need help writing UDF to determine the Row number of a value
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default

Quote:
Originally Posted by p45cal View Post
Change your formula in cell B2 to say:
=matchrow(A2,$C$1:$N$10)
copy down if you want.
Put values you're looking for in column A next to the formulae.

Remove all the Dims at the top of the code-module.

Change your function to:
Code:
Function matchrow(x, interval)
Dim a As Range
Set a = interval.Find(x, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False, searchformat:=False)
If Not a Is Nothing Then matchrow = a.Row Else matchrow = "Not found"
End Function
Thank you veru much. The problem was solved.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help writing UDF to determine the Row number of a value How to determine if a Section number has a field code scienceguy Word VBA 8 11-11-2021 05:19 AM
Word writing {PAGE} instead of inserting page number Johanna Word 5 07-04-2019 07:56 AM
Need help writing UDF to determine the Row number of a value Determine if a cell contains a 0 value bgranzow Word VBA 1 01-07-2016 03:50 PM
Need help writing UDF to determine the Row number of a value Is there a way programmatically to determine the footnote number style, if other than arabic numbers gn4619 Word VBA 2 11-23-2015 11:00 PM
Need help writing UDF to determine the Row number of a value Edit number of characters per page after writing whole paper dea Word 1 01-04-2011 02:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft