Any help is much appreciated, I am learning VBA on the go and cannot seem to work through this issue.
Thanks!
Example Below:
Column A Column B
Portfolio 1:
AAPL
DIS
YHOO
Portfolio 2:
AAPL FORMULA (=A7&" US Equity")
FB
TWTR
XOM
Portfolio 3:
COP
KO
WMT
I am looking to write a code that fills down the formula only for the 2nd portfolio (down to XOM) and is able to adjust as the start and end of portfolio 2 shift depending on the number of holdings. I am able to locate where the formula begins using this code:
With Columns("I")
.Find(what:="*", after:=.Cells(1, 1), LookIn:=xlValues).Activate
End With
However, where I am having issues is defining this to stop at the row of XOM (ie. up until the next blank in column A from the start of the fill). At the moment I have only enabled it to fill all the way down to the bottom of the sheet, rather than stopping at the end of this set of rows. I cannot figure out how to alter this code to get my desired results:
With Columns("I")
.Find(what:="*", after:=.Cells(1, 1), LookIn:=xlValues).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).FillDown
End With
Thanks!
Example Below:
Column A Column B
Portfolio 1:
AAPL
DIS
YHOO
Portfolio 2:
AAPL FORMULA (=A7&" US Equity")
FB
TWTR
XOM
Portfolio 3:
COP
KO
WMT
I am looking to write a code that fills down the formula only for the 2nd portfolio (down to XOM) and is able to adjust as the start and end of portfolio 2 shift depending on the number of holdings. I am able to locate where the formula begins using this code:
With Columns("I")
.Find(what:="*", after:=.Cells(1, 1), LookIn:=xlValues).Activate
End With
However, where I am having issues is defining this to stop at the row of XOM (ie. up until the next blank in column A from the start of the fill). At the moment I have only enabled it to fill all the way down to the bottom of the sheet, rather than stopping at the end of this set of rows. I cannot figure out how to alter this code to get my desired results:
With Columns("I")
.Find(what:="*", after:=.Cells(1, 1), LookIn:=xlValues).Activate
Range(ActiveCell, ActiveCell.End(xlDown)).FillDown
End With