VB for defined range, I think!

Stu Dapples

Active Member
Joined
Jan 12, 2009
Messages
252
I am trying to set up a sheet so when the user runs the regression, it will slelect the last 12 records in a specified column, copy them to a "graph driver" sheet and update....

I have got this far which looks like it is working right up to the point where I want to say OK, now go get the data!

<CODE>
Sub Regression_Copy()
'
' Regression_Copy Macro
Dim Start As String
Dim Finish As String


Sheets("Data").Select
Range("E1").Select
Range("E1").End(xlDown).Select
Finish = ActiveCell.Address
ActiveCell.Offset(-12, 0).Select
Start = ActiveCell.Address

Range("Start:Finish").Select
</CODE>
I know it is the range statement at teh end which I have wrong but I cant work out how to tell it use the 2 addresses within the range statement.... Hope that makes some sort of sense, many thanks in advance for your help!

Stu
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Maybe something like:
Code:
Range("E1").End(xlDown).Offset(-11).Resize(12).Copy Destination:=blah blah blah
 
Last edited:
Upvote 0
Maybe something like:
Code:
Range("E1").End(xlDown).Offset(-11).Resize(12).Copy Destination:=blah blah blah

Looks like a good solution, will give it a whirl!!

Is there a way to use Dims in a statement like this? I am sure your method will work but it is something I am interested in....

Many thanks again ;)
 
Upvote 0

Forum statistics

Threads
1,214,789
Messages
6,121,593
Members
449,038
Latest member
Arbind kumar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top