Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default LOOKUP iterations in VBA 2007

In the sub below, LOOKUP returns a value (LookUpAnswer) that is copied to
cell G13 of a different sheet in the workbook. I need to repeat this
procedure 15 times, each time changing the first argument of LOOKUP (€śTotal A
BndfndIntermed€ť, in the example) and changing as well the cell into which the
return value is copied.

My problem: Nothing Ive tried has worked to clear the return value of a
given iteration of the code so as to return the correct value on subsequent
iterations. How can I do this?

A related question: I know that my approach is not the most economical or
elegant way of accomplishing what Im trying to do. Any suggestions for a
better approach that would run through the 15 iterations, each time changing
the LOOKUP argument and the cell range into which the return is copied?

Dim Lookupanswer
Dim LookupRange As Range
Set LookupRange = Worksheets("PortfolioByType").Range("C1:I20")
Lookupanswer = Application.WorksheetFunction _
.Lookup("TOTAL A BndFndIntermd", Worksheets("PortfolioBytype") _
.Range("C1:I120"))


Worksheets("AssetAllocation").Activate
Range("G13").Select
Selection.Value = Lookupanswer
Range("A1").Select

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default LOOKUP iterations in VBA 2007

Probably better to use FIND or FINDNEXT macro. Then you want the value??
copied where.

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JCIrish" wrote in message
...
In the sub below, LOOKUP returns a value (LookUpAnswer) that is copied to
cell G13 of a different sheet in the workbook. I need to repeat this
procedure 15 times, each time changing the first argument of LOOKUP
(€śTotal A
BndfndIntermed€ť, in the example) and changing as well the cell into which
the
return value is copied.

My problem: Nothing Ive tried has worked to clear the return value of a
given iteration of the code so as to return the correct value on
subsequent
iterations. How can I do this?

A related question: I know that my approach is not the most economical or
elegant way of accomplishing what Im trying to do. Any suggestions for a
better approach that would run through the 15 iterations, each time
changing
the LOOKUP argument and the cell range into which the return is copied?

Dim Lookupanswer
Dim LookupRange As Range
Set LookupRange = Worksheets("PortfolioByType").Range("C1:I20")
Lookupanswer = Application.WorksheetFunction _
.Lookup("TOTAL A BndFndIntermd", Worksheets("PortfolioBytype") _
.Range("C1:I120"))


Worksheets("AssetAllocation").Activate
Range("G13").Select
Selection.Value = Lookupanswer
Range("A1").Select


Reply
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
When IF has limited iterations Drew[_2_] Excel Discussion (Misc queries) 10 June 30th 08 07:42 AM
iterations? Dave O. Excel Worksheet Functions 2 October 23rd 07 12:26 AM
# of iterations Rick Excel Worksheet Functions 1 May 10th 07 04:41 PM
Macro for iterations.... Nick Krill Excel Discussion (Misc queries) 3 April 19th 07 07:44 PM
Iterations antonje New Users to Excel 2 October 10th 06 08:11 PM


All times are GMT +1. The time now is 01:17 AM.

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

About Us

"It's about Microsoft Excel"