Hi Everyone,
So Im stumped, and I have found no soulutions online as of yet.
Im using Excel 2010.
I recive a report that never has the headers in the same spot twice, so I cant reference them by cell.
I figured out how to reference the first unused column in the worksheet, then flood fill it with my formulas... as seen below:
what I want to do, is (for instance with LLTMat) do a Countif and assign that to a named cell.
My question is, How do I reference the entire column when I only have the header address.
as always, Thank you all for your time and your help.
~Qazzart
So Im stumped, and I have found no soulutions online as of yet.
Im using Excel 2010.
I recive a report that never has the headers in the same spot twice, so I cant reference them by cell.
I figured out how to reference the first unused column in the worksheet, then flood fill it with my formulas... as seen below:
Code:
sub test()
'....some code here.....
j = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Column + 1
i = ActiveSheet.UsedRange.Rows.Count
Set rngBackordered = ActiveSheet.UsedRange.Find("Backordered", , xlValues, xlWhole)
Backordered = rngBackordered.Offset(1, 0).Address(False, False)
Set rngLLTMat = ActiveSheet.UsedRange.Find("LLT Mat", , xlValues, xlWhole)
LLTMat = rngLLTMat.Offset(1, 0).Address(False, False)
Set rngInPurchase = ActiveSheet.UsedRange.Find("In Purchase", , xlValues, xlWhole)
InPurchase = rngInPurchase.Offset(1, 0).Address(False, False)
Cells(1, j).Value = "LLT Unawarded"
With Range(Cells(2, j), Cells(i, j))
.Formula = "=IF(OR(AND(" & LLTMat & "=""Yes""," & Backordered & "=""Yes""),AND(" & LLTMat & "=""Yes""," & InPurchase & "=""Yes"")),""Yes"",""No"")"
.Value = .Value
End With
'....some code here.....
end sub
what I want to do, is (for instance with LLTMat) do a Countif and assign that to a named cell.
Code:
[TotalLLTMat] = worksheetfuntion.CountIf(Range(), "Yes")
My question is, How do I reference the entire column when I only have the header address.
as always, Thank you all for your time and your help.
~Qazzart