ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   .cells question (https://www.excelbanter.com/excel-programming/412432-cells-question.html)

Mona

.cells question
 
I have this formula:
..Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 9)).FillDown

cStartRow=12 and nRows=counter that counts the number of rows. 9=column.

I want to use this formula for column 9 through 15. I could repeat formula
7 times and change the column number but surely there is a better way!

Thanks in advance!

Per Jessen

.cells question
 
Hi

This should do it (untested)

..Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 15)).FillDown

Regards,
Per

"Mona" skrev i meddelelsen
...
I have this formula:
.Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 9)).FillDown

cStartRow=12 and nRows=counter that counts the number of rows. 9=column.

I want to use this formula for column 9 through 15. I could repeat
formula
7 times and change the column number but surely there is a better way!

Thanks in advance!



Dave Peterson

.cells question
 
dim iCol as long
for icol = 9 to 15
'do what you want...
.range(.cells(cstartrow,icol),.cells(cstartrow+nro ws,icol)).filldown
next icol



Mona wrote:

I have this formula:
.Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 9)).FillDown

cStartRow=12 and nRows=counter that counts the number of rows. 9=column.

I want to use this formula for column 9 through 15. I could repeat formula
7 times and change the column number but surely there is a better way!

Thanks in advance!


--

Dave Peterson

Mona

.cells question
 
perfect!!

"Per Jessen" wrote:

Hi

This should do it (untested)

..Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 15)).FillDown

Regards,
Per

"Mona" skrev i meddelelsen
...
I have this formula:
.Range(.Cells(cStartRow, 9), .Cells(cStartRow + nRows, 9)).FillDown

cStartRow=12 and nRows=counter that counts the number of rows. 9=column.

I want to use this formula for column 9 through 15. I could repeat
formula
7 times and change the column number but surely there is a better way!

Thanks in advance!





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

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