Aug 06 2021 11:51 AM
Hi, all. I have a simplified section of a complex (?!) spreadsheet I'm struggling with.
Entering a destination and journey finish mileometer reading fills a cell with the mileage.
For payment, this mileage is segregated into bands, eg 1 to 100 miles, Band 1, 101 to 200 miles, Band 2.
For one worksheet, this should be relatively easy, even for me! But I just can't get it to work.
When the "mileage" cell value changes, it should call a sub which fills in the "banding" cell relative to the mileage value.
But, and this is the first problem, entering the finish mileage, which allows the "mileage" cell to display, triggers the change mechanism, steering the Target_Address away from the intended target ("mileage") to itself, "Finish Miles".
The second problem may be solved if the first one is, perhaps. How to have the sub sitting in the module, being called by the Active Sheet, instead of sitting in each sheet. There are many more sheets than in the excerpt.
Any and all help / advice will be appreciated.
Best regards, Pete
Aug 06 2021 12:10 PM
Solution@Peter_Field Don't think you need VBA here. You can use a lookup table like in the attached workbook.
Aug 06 2021 12:15 PM
Do you really need code? You could enter the following formula in E2, then fill down as far as you want:
=IF(D2="","","Band "&ROUNDUP(D2,-2)/100)
Aug 06 2021 01:53 PM
Aug 06 2021 01:55 PM
Aug 06 2021 12:10 PM
Solution@Peter_Field Don't think you need VBA here. You can use a lookup table like in the attached workbook.