Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.dotnet.framework,microsoft.public.dotnet.languages.csharp,microsoft.public.dotnet.languages.vb,microsoft.public.excel.programming
|
|||
|
|||
How to get the position of a cell in Excel named range?
'** The code to search some value in the named range
Sub searchInRange(RangeName As String, Value As String) Dim namedRange As Range Dim rangecells As Range Dim mIntCells As Integer Dim mIntCtr As Integer Set namedRange = Names(RangeName).RefersToRange mIntCells = namedRange.Count Set rangecells = namedRange.Cells For mIntCtr = 1 To mIntCells If rangecells.Item(mIntCtr) = Value Then MsgBox "got it at : " & "row - " & rangecells.Item(mIntCtr).Row & _ "col - " & rangecells.Item(mIntCtr).Column & " -- " & rangecells.Item(mIntCtr).Address Exit For Else Debug.Print rangecells.Item(mIntCtr).Value End If Next End Sub '** This is how you will call it call searchInRange("myrange", "myvalue") HTH Kalpesh "Alan White" wrote in message ... Hi Groups, I'd like to know if someone could show me how to get the position (col, row) of a cell in excel named range. What I need to do is: I will need to loop through a named range to find a particular cell by value, once I found it, I need to know the position of that cell. I'm doing this with C#, but any VB code would be help too. Thanks!. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Referring to specific cell in named range in Excel formula | Excel Worksheet Functions | |||
inserting a named range into new cells based on a named cell | Excel Discussion (Misc queries) | |||
Position of a cell in a range | Excel Worksheet Functions | |||
How to get the position of a cell in Excel named range? | Excel Programming | |||
How to get the position of a cell in Excel named range? | Excel Programming |