Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Refer to rows in a range

How can I refer to different rows in a range and include the cell addresses
into a formula being entered onto a sheet by macro?

What I'm trying to do is:

- Range = a1:m100 of another sheet
- formula: .Range("A49").FORMULA = "=LOOKUP(cells in first row in range)"
- more code in a loop
- back to start of loop
- formula: .Range("A49").FORMULA = "=LOOKUP(cells in second row in range)"
- and so on...

I hope this makes sense - the code is very long and detailed and only need
help with this small (but crucial!!) part...

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Refer to rows in a range


Dim cnt As Long
Dim rOS As Range 'Range offset
Dim FormulaString As String
Set rOS = Selection.Cells(1, 1)
For cnt = 1 To YourRange.Rows.Count
FormulaString = "'" & YourAnotherSheet & "'!" & Cells(rOS.Row + cnt
- 1, rOS.Column).Address(False,False) & ":" & _
Cells(rOS.Row + cnt - 1, rOS.Column +
YourRange.Columns.Count).Address(False,False)
Range("A49").Formula = "=VLookup(" & FormulaString &
otherparameters")"
Next

HTH

Die_Another_Day
ewan7279 wrote:
How can I refer to different rows in a range and include the cell addresses
into a formula being entered onto a sheet by macro?

What I'm trying to do is:

- Range = a1:m100 of another sheet
- formula: .Range("A49").FORMULA = "=LOOKUP(cells in first row in range)"
- more code in a loop
- back to start of loop
- formula: .Range("A49").FORMULA = "=LOOKUP(cells in second row in range)"
- and so on...

I hope this makes sense - the code is very long and detailed and only need
help with this small (but crucial!!) part...

TIA


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
How to refer to a range except one cell hs Excel Discussion (Misc queries) 4 December 6th 09 11:05 PM
refer to range in another sheet Smallweed Excel Discussion (Misc queries) 5 November 13th 09 12:47 PM
How do I refer a Range to a Cell Mal Excel Worksheet Functions 6 June 7th 05 08:47 AM
How do you refer to a dynamic named range? Ian Staines Excel Programming 3 September 14th 03 10:48 PM
Can VLookup refer to a cell with a range name? Tom Ogilvy Excel Programming 0 August 26th 03 02:24 PM


All times are GMT +1. The time now is 07:31 PM.

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"