ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   filldown macro (https://www.excelbanter.com/excel-programming/338915-filldown-macro.html)

BorisS

filldown macro
 
Have the following code, by recording the macro:

ActiveCell.Offset(0, -1).Range("A1:B1").Select
ActiveCell.Offset(0, 1).Activate
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(0, -1).Range("A1:B16").Select
ActiveCell.Activate
Selection.FillDown

Am trying to:
1) get one cell to grab itself and the one to its immediate left
2) ctrl+shft+down on the first cell's (not the one it grabs) column
3) take one row less than the stretchdown length
4) fill down

Problem is twofold...

1) highlight area is taking column A:B, instead of B:C (assume C is where I
started and where I want to go one immediate left from)
2) haven't gotten there, but seems like the relativity of the stretchdown is
only good through finding the next value, but then is set at 16 rows. The 16
rows may vary, so I need it to actually count the number of rows in the
highlight area and take that minus 1 as the length of the highlight area.

any suggestions on tweaks are appreciated.
--
Boris

Patrick Molloy[_2_]

filldown macro
 
Sub CopyFill()
Dim cell As Range
Set cell = Selection.Offset(0, -1).Resize(1, 2)
With cell

With Range(cell, .End(xlDown).Offset(-1, 0))

.FillDown

End With
End With


End Sub


"BorisS" wrote:

Have the following code, by recording the macro:

ActiveCell.Offset(0, -1).Range("A1:B1").Select
ActiveCell.Offset(0, 1).Activate
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Offset(0, -1).Range("A1:B16").Select
ActiveCell.Activate
Selection.FillDown

Am trying to:
1) get one cell to grab itself and the one to its immediate left
2) ctrl+shft+down on the first cell's (not the one it grabs) column
3) take one row less than the stretchdown length
4) fill down

Problem is twofold...

1) highlight area is taking column A:B, instead of B:C (assume C is where I
started and where I want to go one immediate left from)
2) haven't gotten there, but seems like the relativity of the stretchdown is
only good through finding the next value, but then is set at 16 rows. The 16
rows may vary, so I need it to actually count the number of rows in the
highlight area and take that minus 1 as the length of the highlight area.

any suggestions on tweaks are appreciated.
--
Boris



All times are GMT +1. The time now is 06:07 AM.

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