Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Hugh Jago
 
Posts: n/a
Default Setting a variable cell address

I'm trying to run a macro.
The data can change in row length from spreadsheet to spreadsheet.
I want to find the end of the data (i.e row 20 or row 1000)
and in the next row set up various arrays.

Obviously the 'shft' + 'ctrl' down arrow takes me to the end bottom of the
data, but the macro then sets absolute address so the next spreadsheet gets
the wrong parameters.

Any ideas?

Thanks



  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default


cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hugh Jago" wrote in message
...
I'm trying to run a macro.
The data can change in row length from spreadsheet to spreadsheet.
I want to find the end of the data (i.e row 20 or row 1000)
and in the next row set up various arrays.

Obviously the 'shft' + 'ctrl' down arrow takes me to the end bottom of the
data, but the macro then sets absolute address so the next spreadsheet

gets
the wrong parameters.

Any ideas?

Thanks





  #3   Report Post  
Hugh Jago
 
Posts: n/a
Default

Bob,
Thanks for the reply, but for the life of me I can't get this to work.
As an example if I start with Data from A2 to A6 then I need to go to A2,
count down, and in cell A8 I want to bring in additional calculations.
The next time I may have data from A2 to A10, so the additional calculations
will be pasted into A12.
Your thoughts greatly appreciated.

Hugh
"Bob Phillips" wrote in message
...

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hugh Jago" wrote in message
...
I'm trying to run a macro.
The data can change in row length from spreadsheet to spreadsheet.
I want to find the end of the data (i.e row 20 or row 1000)
and in the next row set up various arrays.

Obviously the 'shft' + 'ctrl' down arrow takes me to the end bottom of
the
data, but the macro then sets absolute address so the next spreadsheet

gets
the wrong parameters.

Any ideas?

Thanks







  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hugh,

If you debug this, you will see that cLastRow will return 6. To then access
A8, you would use something like

Cells(cLastRow+2,"A").Value = ...

Next time, cLastRow will return 8, etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hugh Jago" wrote in message
...
Bob,
Thanks for the reply, but for the life of me I can't get this to work.
As an example if I start with Data from A2 to A6 then I need to go to A2,
count down, and in cell A8 I want to bring in additional calculations.
The next time I may have data from A2 to A10, so the additional

calculations
will be pasted into A12.
Your thoughts greatly appreciated.

Hugh
"Bob Phillips" wrote in message
...

cLastRow = Cells(Rows.Count,"A").End(xlUp).Row

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hugh Jago" wrote in message
...
I'm trying to run a macro.
The data can change in row length from spreadsheet to spreadsheet.
I want to find the end of the data (i.e row 20 or row 1000)
and in the next row set up various arrays.

Obviously the 'shft' + 'ctrl' down arrow takes me to the end bottom of
the
data, but the macro then sets absolute address so the next spreadsheet

gets
the wrong parameters.

Any ideas?

Thanks









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
Concatenate cells without specifying/writing cell address individually Hari Excel Discussion (Misc queries) 4 January 3rd 05 06:05 PM
How do I dynamically retrieve the cell address of the last cell t. Nancy Excel Discussion (Misc queries) 1 December 20th 04 02:52 PM
How can I insert a cell reference in a footer (eg for variable foo GW Excel Discussion (Misc queries) 1 December 15th 04 10:58 AM
How can I insert a cell reference in a footer (eg for variable foo wngg001 Excel Discussion (Misc queries) 1 December 15th 04 10:56 AM
Cell reference - for the sheet name, can I use a variable? Matt Lawson Excel Discussion (Misc queries) 4 December 13th 04 02:31 PM


All times are GMT +1. The time now is 12:51 AM.

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"