![]() |
Macro Problems
I am attempting to create a macro in Excel and am encountering problems.
The details are as follows: The macro is for use in producing invoices, the template for which is set up in Excel. The majority of my invoices use exactly the same wording, i.e. Collect defective item and transport to our workshop Strip item Clean parts Etc. What has been happening is that when I run the macro it only prints the first line unless I position the cursor in exactly the same cell as the starting point when creating the macro. I actually need to be able to commence the macro from any starting point. I am not very familiary with Excel, but have discovered that my problem is to do with relative references. However, I have tried recording a macro with the feature turned on, and then with it turned off, and the result is the same each time. A further problem which has nowoccurred is that when I press the €˜record macro button, the stop recording toolbar which contains the relative reference button no longer appears on the screen. Whats happened to it? How do I get it back? I would be grateful for any help on these issues as I have been struggling to resolve them myself for some now. gillj |
Macro Problems
You have hit upon the major limitation of recording macros, you have to do exactly the same thing each time. By manually editing the macro you have recorded or by writing one from first principles, you can overcome this limitation. There are some examples on my download page which show what a non-recorded macro might look like. In you particular case, I would suggest that you look at the macro code (ALT F11) and you add a new line to the beginning just after the Sub Macro1 line. Range("A1").Select This will work assuming that A1 is the cell that has to be selected in order for the macro to work properly. The effect of this line is to mimic the action of selecting the cell. I hope that this helps. -- mrice Research Scientist with many years of spreadsheet development experience ------------------------------------------------------------------------ mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931 View this thread: http://www.excelforum.com/showthread...hreadid=539504 |
All times are GMT +1. The time now is 04:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com