Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Finding last items in a list

Hi,

I am trying to write a macro to automate some data extraction from a
text file. My text file consists of three columns of numbers. The
number of lines of data varies from file to file.

I would like to use the 'slope' function to do a regression on the
last 20 lines of data but I am getting confused about how to specify
that range in the formula since the range will be different in every
text file I have.

Yell at me if I'm not making myself clear. Hope someone can help me

thanks
Ben

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Finding last items in a list

Hi Ben,

A clumsy but effective method I use is to select the top cell in the last
(rightmost)column of data and then do Selection.End(xlDown).Select (same as
CTRL +DownArrow) on the keyboard - assuming there are no gaps in the data,
this will select the bottom cell in the column. You can then do
Range(Selection, Selection.Offset(-20, -xxx)).Select where xxx is the number
of columns to the left you want to select.

If there may be gaps in the data, then go to a cell below the last entry in
the in the rightmost column (e.g.65535) and then do
Selection.End(xlUp).Select (Same as CTRL+UpArrow on the keyboard.

Regards,

Z


" wrote:

Hi,

I am trying to write a macro to automate some data extraction from a
text file. My text file consists of three columns of numbers. The
number of lines of data varies from file to file.

I would like to use the 'slope' function to do a regression on the
last 20 lines of data but I am getting confused about how to specify
that range in the formula since the range will be different in every
text file I have.

Yell at me if I'm not making myself clear. Hope someone can help me

thanks
Ben


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Finding last items in a list


Teriffic. That does what I need. I used:

Range(Selection, Selection.Offset(-20, -xxx)).name = "lastcells"

to name the group of cells so I could reference it in the funciton.

thanks
Ben


On 10 Oct, 10:08, Zarch wrote:
Hi Ben,

A clumsy but effective method I use is to select the top cell in the last
(rightmost)column of data and then do Selection.End(xlDown).Select (same as
CTRL +DownArrow) on the keyboard - assuming there are no gaps in the data,
this will select the bottom cell in the column. You can then do
Range(Selection, Selection.Offset(-20, -xxx)).Select where xxx is the number
of columns to the left you want to select.

If there may be gaps in the data, then go to a cell below the last entry in
the in the rightmost column (e.g.65535) and then do
Selection.End(xlUp).Select (Same as CTRL+UpArrow on the keyboard.

Regards,

Z



" wrote:
Hi,


I am trying to write a macro to automate some data extraction from a
text file. My text file consists of three columns of numbers. The
number of lines of data varies from file to file.


I would like to use the 'slope' function to do a regression on the
last 20 lines of data but I am getting confused about how to specify
that range in the formula since the range will be different in every
text file I have.


Yell at me if I'm not making myself clear. Hope someone can help me


thanks
Ben- Hide quoted text -


- Show quoted text -


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
Wildcard for finding items that start with ? KrispyData Excel Discussion (Misc queries) 4 August 7th 09 04:17 PM
Finding multiple items from a list Col Excel Worksheet Functions 4 September 26th 08 01:39 AM
Data Validation: items in one list relate to items in another Paul D. Simon Excel Programming 1 August 4th 05 09:17 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM
Items in disabled items list - unknown excel addins causing probs Rich Excel Programming 4 May 16th 05 10:31 PM


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