Anomandaris
03-31-2009, 06:30 AM
Hi again guys,
Seems like I keep coming up with weird requests, the latest one involves coming up with a macro that can change a number based on its last digit.
Lets say the number is 3266, so the macro should take the last digit '6' and divide it by 8 which gives us 0.75, this is then added to the previous three digits '326' to get '326.75'.
I need another macro that will divide the numbers in a column by 100.
I've attached a file with just one sheet(Sheet1)
You can see a few products with their respective prices. What I want to do is using Data filter- to select a product ....say 'Wheat' then running a macro so that only the Wheat prices change in that column, while the other product prices remain the same, then I would select another product using 'filter' and run a different macro, so product prices would be changed in the same column using different macros.
I hope I didnt make that sound confusing.
The new 'macro adjusted' prices should appear in the same column F, replacing the old value.
Thanks for reading, and hope this can be done...I couldnt think of any code to select the last digit of a number (and oh by last digit I dont mean a decimal place . In 5006.00 the last digit is 6).
Seems like I keep coming up with weird requests, the latest one involves coming up with a macro that can change a number based on its last digit.
Lets say the number is 3266, so the macro should take the last digit '6' and divide it by 8 which gives us 0.75, this is then added to the previous three digits '326' to get '326.75'.
I need another macro that will divide the numbers in a column by 100.
I've attached a file with just one sheet(Sheet1)
You can see a few products with their respective prices. What I want to do is using Data filter- to select a product ....say 'Wheat' then running a macro so that only the Wheat prices change in that column, while the other product prices remain the same, then I would select another product using 'filter' and run a different macro, so product prices would be changed in the same column using different macros.
I hope I didnt make that sound confusing.
The new 'macro adjusted' prices should appear in the same column F, replacing the old value.
Thanks for reading, and hope this can be done...I couldnt think of any code to select the last digit of a number (and oh by last digit I dont mean a decimal place . In 5006.00 the last digit is 6).