LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Define variable range

Thanks for the suggestion Tom
In the end what I've done is this:

First of all I named the data sheet OriginalData, and added a new blan
sheet Calculations. I added data labels to the original data, so tha
the data itself was in cells A2:A14

Public Sub FirstRange()

Dim i As Integer

Sheets("OriginalData").Activate
Range("A2").Select

Dim xvalues As String
Dim yvalues As String

Dim Rng1 As Range
Dim Rng2 As Range

Set Rng1 = Range("e1")
Set Rng2 = Range("f1")

i = 1

xvalues = Sheets("OriginalData").Range("A" & i).Value
yvalues = Sheets("OriginalData").Range("B" & i).Value

Do While ActiveCell.Value < Rng2
i = i + 1

xvalues = Sheets("OriginalData").Range("A" & i).Value
yvalues = Sheets("OriginalData").Range("B" & i).Value

'Populate the sheet Calculations with selected range
Sheets("Calculations").Activate
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = xvalues
ActiveCell.Offset(0, 1).Value = yvalues

Loop

End Sub


- bit clunky but it works!


Tom Ogilvy wrote:
*=Offset(B1,E1,0,F1-4,1)

Might be what you want.

It assumes E1 is a cell offset and the value in F1 refers to th
integers
4-16 inclusive in column A.

--
Regards,
Tom Ogilvy

"acberry " wrote in message
...
Hi
I'm not even sure this is possible so advice would be welcome!

I need to define a y range based on two variable x parameters, x

and
x2.

To give an example, x values ranging as integers from 4 to 16 ar

in
column A (A1:A13) on my spreadsheet, corresponding y values i

column
B. I have listed x1 in cell E1 and x2 in cell F1. x1 = 0 and x2

12
for this particular example.

If 0<=x<12, I want to define the corresponding y range from colum

B.
Here it would be the range B1:B8.

Any suggestions?


---
Message posted from http://www.ExcelForum.com/


--
Message posted from http://www.ExcelForum.com

 
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
Define variable range input for SUM() function JeffC Excel Worksheet Functions 4 May 16th 09 03:54 AM
Define Variable Name using VBA GTReferee Excel Discussion (Misc queries) 2 January 21st 09 06:37 PM
Using a Variable to Define Series Posse John Charts and Charting in Excel 2 August 30th 06 01:18 PM
How to take the worksheet name as a variable(Label/Define) in a fo Subin Excel Worksheet Functions 2 March 14th 06 12:43 PM
Syntax to define a variable for current file Mervyn Thomas Excel Programming 2 December 22nd 03 06:01 PM


All times are GMT +1. The time now is 01:07 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"