How to get the position of a cell in Excel named range?
This should get you started. It assumes that your named range is
MyRange, that you are looking for the value 172 on the ActiveSheet, and that you are looking for the first occurence of that value. Of course, these assumptions are probably simplified and the code may require modification. Sub ColRow() Dim lngRow As Long, lngCol As Long Dim rngFind As Range With ActiveSheet.Range("MyRange") Set rngFind = .Find(what:=172, LookAt:=xlWhole) If Not rngFind Is Nothing Then lngCol = rngFind.Column lngRow = rngFind.Row End If End With End Sub HTH Paul -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. -------------------------------------------------------------------------------------------------------------- On Wed, 9 Jul 2003 18:40:09 -0700, "Alan White" wrote: 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!. |
All times are GMT +1. The time now is 10:38 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com