I'm trying to remove code from worksheet to elimnate user altering/deleting. I can lock sheets, but want more control over code in sheets.
I have a chart that uses vlookup and sumproduct, rather than leave the vlookup on the sheet I'm trying to put it in vba
This is one of the data source cells for the chart
techchart (a named cell) is the technumber of the formula I'm trying to relocate.
=SUMPRODUCT(--(item27=scan_item),--(QCDate>=WkStart),--(QCDate<=RangeEnd),--(Techs=techChart))
This is the cell I pull the pass and fail results.
="Pass" & ": "&TechPass &" Fail: "&TechFail
I have a table of data of pass and fail items,
using sumproduct within a date range, the chart shows results based on a drop down validation list from range AJ7 to AO67 (the AO67 may change)
part of controling the code is I want to use a count on the rows down incase I add or remove the total techs so AO67 might go to 68 or 66
[vba]
Function FindTechNumber()
Dim technum As short
Dim TechPassValue As short
Dim TechFailValue As short
With Worksheets("Chart")
Set technum = "VLookup(AD35, AJ7:AO67, 3)"
Set TechPassValue = "VLookup(AD35, AJ7:AO67, 5)"
Set TechFailValue = "VLookup(AD35, AJ7:AO67, 6)"
' on change of validation list in AD35 re-calculate these values?
End Function[/vba]
The file is working with code on the worksheet, but fails if I add a tech or delete one.
I supply other offices with this workbook and they have different numbers of techs, so the AO67 value may change, being able to allow vba code to accomidate that will help deployment.
If I can get the coding in VBA is the best so others can't (are less likely) break it...
Thanks in advance.