Guild of Project Controls: Compendium | Roles | Assessment | Certifications | Membership

Tips on using this forum..

(1) Explain your problem, don't simply post "This isn't working". What were you doing when you faced the problem? What have you tried to resolve - did you look for a solution using "Search" ? Has it happened just once or several times?

(2) It's also good to get feedback when a solution is found, return to the original post to explain how it was resolved so that more people can also use the results.

Excel VBA Help (I didn’t know where else to put it?)

1 reply [Last post]
Tim Colton
User offline. Last seen 13 years 50 weeks ago. Offline
Joined: 23 Mar 2009
Posts: 3
Groups: None
Hello

i was wondering if anyone here has any experiance with writing macros. I have just inherited a project and a lot of the information is in excel spread sheets. This I don’t mind it is just that the previous project manager was a wiz at macros. This means that I now have to learn so. I just need to know how to programme a simple copy and paste loop.

The problem:

I have a table. I need to copy from it the rows of the table and some cells of the cells above the table. The cells above the table need to be repeated for every row. The whole loop needs to be repeated until there is an empty cell at he bottom of the table.

Cheers for your help.

Replies

Rodel Marasigan
User offline. Last seen 12 hours 26 min ago. Offline
Joined: 25 Oct 2006
Posts: 1699
Tim,
You can use record macro in Excel (Tools-> Macro-> Record New Macro)
Then record the task you’re doing and it will automatically write a macro for you. Record the complete task that you want to do. (Single pass task before it goes to same task or loop)
Ex: Highlight row then copy and go to another cell and then paste.

After recording the macro click Stop Macro. Then go to Tools-> Macro-> Visual Basic Editor. Find folder Module on the left (Project Object) and double click Module 1 or any module created. On the right side window panel it show the recorded code. Copy and paste the code in this post so I can understand what do you want to do and I will modify the code to create the loop that you can execute to do the task automatically.

Best Regards,
Rodel