ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting and pasting formula into a variable field size! (https://www.excelbanter.com/excel-programming/377479-selecting-pasting-formula-into-variable-field-size.html)

[email protected]

Selecting and pasting formula into a variable field size!
 
Hi All,

I have a work sheet that I am importing some data into, from column
I:Q, however the imported data is variable, i.e there could be 30-3000
records imported.

I am running a marco that selects the formula I would like to copy
down, but need a line that will let me fill down however stopping at
the end of the valid cells?

I have tried all sorts, going in reverse, chosing the last cell in
column I, then using the offset rule. however when trying to copy to
all the cells above (excluding top line) I can not get this value to be
variable.

Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Activate
Range("A2:H163").Select

This is what I have, I would love to work from line 2 down to last
line... but I am having a few difficulties.

any help would be great.

Regards
Craig


[email protected]

Selecting and pasting formula into a variable field size!
 
If I understand you correctly, you want to copy range A2:H163. Then you
would change the last line to something like:

Range("A2:H" & CStr(ActiveCell.Row)).Select

ActiveCell.Row would then return the last row to contain data.

Regards,
Steve

schrieb:

Hi All,

I have a work sheet that I am importing some data into, from column
I:Q, however the imported data is variable, i.e there could be 30-3000
records imported.

I am running a marco that selects the formula I would like to copy
down, but need a line that will let me fill down however stopping at
the end of the valid cells?

I have tried all sorts, going in reverse, chosing the last cell in
column I, then using the offset rule. however when trying to copy to
all the cells above (excluding top line) I can not get this value to be
variable.

Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Activate
Range("A2:H163").Select

This is what I have, I would love to work from line 2 down to last
line... but I am having a few difficulties.

any help would be great.

Regards
Craig



[email protected]

Selecting and pasting formula into a variable field size!
 
This is great, worked perfectly!

Cheers

Craig


wrote:
If I understand you correctly, you want to copy range A2:H163. Then you
would change the last line to something like:

Range("A2:H" & CStr(ActiveCell.Row)).Select

ActiveCell.Row would then return the last row to contain data.

Regards,
Steve

schrieb:

Hi All,

I have a work sheet that I am importing some data into, from column
I:Q, however the imported data is variable, i.e there could be 30-3000
records imported.

I am running a marco that selects the formula I would like to copy
down, but need a line that will let me fill down however stopping at
the end of the valid cells?

I have tried all sorts, going in reverse, chosing the last cell in
column I, then using the offset rule. however when trying to copy to
all the cells above (excluding top line) I can not get this value to be
variable.

Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Activate
Range("A2:H163").Select

This is what I have, I would love to work from line 2 down to last
line... but I am having a few difficulties.

any help would be great.

Regards
Craig




All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com