Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ed,
You would be better off using built-in Excel functionality, along the lines of this, where you have a list in cells A1:A10, with the header in row 1, and you want to find all the cells containing Ed. No need to loop, or build a string, or..... Range("A1:A10").AutoFilter Field:=1, Criteria1:="Ed" Range("A2:A10").SpecialCells(xlCellTypeVisible).Se lect ActiveWorkbook.Names.Add Name:="NewName", RefersTo:= _ "=" & Selection.Address Selection.AutoFilter HTH, Bernie MS Excel MVP "Ed" wrote in message ... To add a range, I am using wb.Names.Add _ Name:=strRng, _ RefersToR1C1:=strAddr This has worked well, but all my ranges so far have been single contiguous blocks of cells. Now I would like to create a range consisting of several blocks of non-contiguous (not touching each other) cells. Specifically, I am going to run down a column and check the value of the data in each cell - if it meets a certain criterion, I want to add that cell address to the RefersTo strAddr. I know there will be long stretches of matching data, interrupted by one or two cells that don't belong. Would it look like "CellRef & CellRef & CellRef", or "CellRef, CellRef, CellRef"? Or is there an easier way altogether? Ed |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Building criteria string for Advanced Filter variable not resolvin | Excel Discussion (Misc queries) | |||
Building Sum by Matching String | Excel Discussion (Misc queries) | |||
Building a String based on Selected Check boxes | Excel Programming | |||
Wierd named range RefersTo value | Excel Programming | |||
building a text string while looping though a worksheet | Excel Programming |