Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Iterate through Names for text
I need to search through the Named Ranges in a sheet and for the ones
that contain certain text, in this case "IMP" then I need to set a conditonal format to the range. I have the conditonal formating part working but Im having trouble iterating through the names for the text My code is Dim zNmRng For Each zNmRng In ActiveSheet.Names ' Iterate through names. If zNmRng = Cells.Find(what:="IMP", After:=ActiveCell, LookIn:=xlValues, LookAt:= _ xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False) Then 'Conditional formating code goes here End If Next I am obviously using the find method incorrectly I also want to have a second condition if, the first conditon is true then I need to see if the name has "ID" in the name and if so skip the code. Im sure that once I figure out how to do the first part, the second is just a mater of nesting. Here are some examples of the named ranges: IMP_100_Hz ---- do LC_100_Hz ------ Skip IMP_ID ------------ Skip IMP_20K_Hz ---- do Any help will be appreciated Robert |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Iterate through a form | Excel Programming | |||
Iterate through controls | Excel Programming | |||
How to iterate through all Text Boxes on a Form? | Excel Programming | |||
Can't iterate thru a row with For | Excel Programming | |||
Iterate columns | Excel Programming |