Question: I have an Excel spreadsheet that contains a regularly updated list of share prices downloaded from the web in column A. In column B, I want to (automatically) record the highest price each share has reached. So I want column B to increase to the value in column A, but only when column A > column B. Answer: This can be done with a macro. Let's take a look at an example. Download Excel spreadsheet (as demonstrated below)
|
In our spreadsheet, the daily quotes are stored in column A and the highest prices are in column B. We placed a button on the sheet that when clicked will update the values in column B if the corresponding value in column A is higher. When the macro is complete, the following message will appear.
|
To view the macro, press Alt-F11 and double-click on the module called Module1 in the left window. You may need to modify the Lrows variable if the macro needs to check more than the first 200 rows in the spreadsheet. Macro Code:This macro code looks like this:
|
Visit our busy book shop, were you can find latest books for beginners as well as advanced excel users.
Spreadsheet 123 Spreadsheet Software Development
See Spreadsheets for:
a.Hotel Management b.Personal Budget
c.Corporate Finance d.Rating Calculation e.Real Estate and Mortgage
f.Web Calc