LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Loop thru named range of second sheet

I have a workbook with 2 sheets in it

On sheet one, I have a layout of fields (range A1 though M20). Cell A1 has
a value in it, and all of the other cells obtain their values using a vlookup
into a named range on sheet two based upon the value in Cell A1 of sheet one.

I need to create a button that will ascertain a value from the user, using a
dropdown, then loop through the named range on sheet two, looking at the
values in column 1. Wherever it finds a match, it needs to pick off the
value of column 2 of the named range, place that value in cell A1 of sheet
one, thus causing all the other values to be filled in via their vlookup
formulas, and then print Range A1 through M20 of sheet one.

I am successfully doing everything except I cannot figure out how to
reference the cells in the named range of sheet two. I need to know what to
put within my double brackets below:

Dim i as integer
Dim strArgValue as string
strArgValue = Cells(23, 1) 'pick up the value from the dropdown
For i = 1 to [[the number of rows in the named range on sheet two]]
If [[col 1 of row i of the named range of sheet two]] = strArgValue then
Cells(1, 1) = [[the value in col 2 of row i of the named range of
sheet two]]
.....Do other processing, including printing the desired range
End If
i = i + 1
Next
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Referencing a named range on another sheet Jan B Excel Worksheet Functions 5 April 4th 23 12:38 PM
Refer to Named Range on another sheet for IF function David Excel Worksheet Functions 3 August 26th 06 04:12 AM
plz help: creating named range in VBA, loop goes haywire KR Excel Programming 2 April 14th 05 07:25 PM
create named range in each sheet in workbook davegb Excel Programming 3 March 29th 05 07:47 PM
Referencing Named Range in Other Sheet Dan E[_2_] Excel Programming 0 July 11th 03 04:22 PM


All times are GMT +1. The time now is 02:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"