ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using a calculated column value within a range (https://www.excelbanter.com/excel-programming/340368-using-calculated-column-value-within-range.html)

gvm

using a calculated column value within a range
 
I need to use code similar to the following:
Range("H13:M13").Select
Selection.AutoFill Destination:=Range("H13:M18"), Type:=xlFillDefault
except that I need the end of the range (M18) to be a calculated value, eg
M13 plus a variable number of rows.

I suspect the solution is to write the range in row and column format, but
how do I do that please?
thanks ... Greg

Norman Jones

using a calculated column value within a range
 
Hi GVM,

Try someting like:

Sub Tester()
Dim iRow As Long

iRow = 50

Range("H13:M13").AutoFill _
Destination:=Range("H13:M" & iRow), _
Type:=xlFillDefault

End Sub
'===================


---
Regards,
Norman



"gvm" wrote in message
...
I need to use code similar to the following:
Range("H13:M13").Select
Selection.AutoFill Destination:=Range("H13:M18"), Type:=xlFillDefault
except that I need the end of the range (M18) to be a calculated value, eg
M13 plus a variable number of rows.

I suspect the solution is to write the range in row and column format, but
how do I do that please?
thanks ... Greg





All times are GMT +1. The time now is 05:23 PM.

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