Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming,microsoft.public.vb.general.discussion
|
|||
|
|||
Writting a MAcro in Excel
Dear Frank
Thanks for your reply. What I do daily, is as follows: 1- I copy and paste daily price of stock market to a worksheet. 2- I use vlookup command to populate the price of my favorite share in another worksheet. (about 10 shares) 3- I draw the graph and save each as a sheet (not as an object) Every day I want to draw the graph from start to today. ( I don't want to take fixed period of time) so time span increases one day on each day. This pushes me to modify the draw command range for each 10 graphs separately. I am looking forward writing a Macro to do this for me. As this job is a series of repetitive commands, I am sure it is possible to write a Macro for it but I don't have that much knowledge of Macro to do so. Today I learned about for for-loops inside Macro. This may help me to do repetitive commands on serial cells. Today I draw this graph: SERIES(Names!$D$66,Names!$E$1:$W$1,Names!$E$66:$W$ 66,1) Tomorrow I draw this graph (w expand to x to include one more cell to right) SERIES(Names!$D$66,Names!$E$1:$X$1,Names!$E$66:$X$ 66,1) I do this separately for 10 sheets (it is tedious, isn't it?) I want to write a Macro to do this for me in each 10 sheets. Frank Above story may not related to relative references (RR), but what I mean with RR is that, I want to execute a series of commands over a range of cells. Then I want to move to next range and perform the same series of commands. When I use fixed range it is for sure that it will act only on that specified range. When I push relative reference button on writing a Macro, I am hoping it will offset the range at the end of Macro but running the Macro doesn't bring the expected result. For example I copy a range of column (A1:A5) go to another sheet, paster special, transpose, paste. Then I want to go to next column (B1:B5) and perform same commands. How can I solve this with RR? TIA, Rasoul Khoshravan Azar, Iran, Tabriz |
#2
Posted to microsoft.public.vb.general.discussion,microsoft.public.excel.programming
|
|||
|
|||
Writting a MAcro in Excel
Hi Rasoul,
This will not probobly help you directly, but it is a different approach to what you are trying to do. I do some similar graphing, but in stead of trying to change the references in the code, I start from "stratch." I define the range I want to graph by starting at the first data point, which is a date and is the newest data. Date Price 12/30/04 10.00 This row has ben inserted and is the newest data. It will always 12/29/04 9.99 be in the same cell on the worksheet. "A2" Then I find the bottom of the data, which can go down a long way, say to "A300". Col B and Col C things like price and volume in them, but the bottom of the data is the same, it all ends on Row 300, so the data runs from "A2" to "C300". The graphing process is automated, as well as finding the New Range to be covered. Hope this will help a little. There are some advantages to this in that you can define with variables, the amount of data you want to graph. Say you only want a years worth of data and not all of, you can use a variable to tell the process that information. Hope this helps. "Rasoul Khoshravan Azar" wrote: Dear Frank Thanks for your reply. What I do daily, is as follows: 1- I copy and paste daily price of stock market to a worksheet. 2- I use vlookup command to populate the price of my favorite share in another worksheet. (about 10 shares) 3- I draw the graph and save each as a sheet (not as an object) Every day I want to draw the graph from start to today. ( I don't want to take fixed period of time) so time span increases one day on each day. This pushes me to modify the draw command range for each 10 graphs separately. I am looking forward writing a Macro to do this for me. As this job is a series of repetitive commands, I am sure it is possible to write a Macro for it but I don't have that much knowledge of Macro to do so. Today I learned about for for-loops inside Macro. This may help me to do repetitive commands on serial cells. Today I draw this graph: SERIES(Names!$D$66,Names!$E$1:$W$1,Names!$E$66:$W$ 66,1) Tomorrow I draw this graph (w expand to x to include one more cell to right) SERIES(Names!$D$66,Names!$E$1:$X$1,Names!$E$66:$X$ 66,1) I do this separately for 10 sheets (it is tedious, isn't it?) I want to write a Macro to do this for me in each 10 sheets. Frank Above story may not related to relative references (RR), but what I mean with RR is that, I want to execute a series of commands over a range of cells. Then I want to move to next range and perform the same series of commands. When I use fixed range it is for sure that it will act only on that specified range. When I push relative reference button on writing a Macro, I am hoping it will offset the range at the end of Macro but running the Macro doesn't bring the expected result. For example I copy a range of column (A1:A5) go to another sheet, paster special, transpose, paste. Then I want to go to next column (B1:B5) and perform same commands. How can I solve this with RR? TIA, Rasoul Khoshravan Azar, Iran, Tabriz |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with writting macro | Excel Discussion (Misc queries) | |||
Help with writting macro | Excel Discussion (Misc queries) | |||
writting a macro for the sum function so I can use it as a keyboard shortcut | Excel Programming | |||
writting a macro for the sum function so I can use it as a keyboard shortcut | Excel Programming | |||
writting a macro for the sum function so I can use it as a keyboard shortcut | Excel Programming |