View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Help building string for Names.Add RefersTo, pls?

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