Hi Guys
London here raining and getting cold.
Recently I was given some beautiful code from tour colleague Norie. It means the code I enter goes to the last active row. I have been able to use this in other places adjusting the very obvious parts. IE when the circumstances are largely the same. Now they aren't and now I can’t.
I have code which looks up using sumifs but I have had to enter row 883 which is my current last row. This will not always be the case so I need to have it only looking in the occupied rows.
Here is the code I have extracted from my VBA sheet
Range("C7").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS('BDC2'!R2C26:R883C26,'BDC2'!R2C5:R883C5,"">=""&VLOOKUP(R[-1]C,QuarterAccountingDates,3,FALSE),'BDC2'!R2C5:R883C5,""<=""&VLOOKUP(R[-1]C,QuarterAccountingDates,4,FALSE))"
[/CODE]
And this is the code from Norie
Dim LastRow As Long
With Worksheets("BDC2")
LastRow = .Range("C" & Rows.Count).End(xlUp).Row
.Range("b2:b" & LastRow).FormulaR1C1 = "=VLOOKUP(RC[2],AccountTable2,2, FALSE)"
End With
They are both in the same Marco but this is now active in the VAT sheet.
I am uploading the spread sheet as a better explanation.
Hope someone has a few moments
Mark
Bookmarks