Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search a named range and put into a variable?

Status
Not open for further replies.

knifey

Technical User
Nov 14, 2006
180
GB
Hi,
I'm a VBA beginner and would appreciate any help and advice you can give.
I have a macro which opens excel workbooks, gathers stats from each, then creates a summary of stats for each date.
The stats are divided into data status's (D00 to D99) and fulfilment status's (F00 to F99) which are named. These are not cell ranges.
I need a way to search the named range for D00, etc. and where found, copy the value in the cell to it's right into a variable, any ideas?

For Each c In [named range]
If c Like "*D00*" Then
?????
End If
Next

Thanks in advance for your help,
Roy


 
Have a look at the Offset property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PH,
Offset will only work within the same workbook. My stats macro opens a source workbook, copies to variables, closes source, paste variables, open next source.
The bit I'm stuck on is copying into a variable as what needs to be copied is in the cell TO THE RIGHT of what I need to search for.
Can anyone steer me right?
Thanks,
Roy
 



"Offset will only work within the same workbook."

"I need a way to search the named range for D00, etc. and where found, copy the value in the cell to it's right into a variable, any ideas?"

Is not the cell to it's right, the cell you want? You get that with the Offset Property of the range object.

Skip,

[glasses] [red][/red]
[tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top