How to learn to write macros

R

Raveendiran RR

Hello All,


Can someone tell me the links where i can learn how to write macros - i
would prefer to do simple things with my macro such as copy information from
several sheets to one sheet, find the average,sum..etc of cell values from
different worksheets
 
E

Ed from AZ

Hello All,

Can someone tell me the links where i can learn how to write macros - i
would prefer to do simple things with my macro such as copy information from
several sheets to one sheet, find the average,sum..etc of cell values from
different worksheets

I started by using the macro recorder, then looking at the code to see
what was happening. In the Visual Basic Editor window where you see
your code, you can set the cursor in any word and press F1 to bring up
the Help file for that term.

Learn to use the Google Groups Search, especially the Advanced
Search. Chances are your question has already been answered for
someone else, and you can see the answers and often even the code that
solved their problem.

There are several good books for VBA macro programming. Many people
don't like books because they don't want to have to read and learn
everything - they just want the quick answer to their question. What
they do not understand is that the quick answer is usually meaningless
unless you know a bit more about what is happening and WHY that is the
answer.

Pick a project - something you would like to make Excel do. Then
using the macro recorder, the Help files, and the newsgroups, put
together a macro to make it happen. Step through it using F8. When
it won't work, get the error message and the line of code that makes
it stop, and post it all back to the newsgroup. (For macros, I would
recommend using the microsoft.public.excel.programming newsgroup.)

Here's a few links to help you out:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
http://www.xldynamic.com/source/xld.VBAMenu.html
http://www.j-walk.com/ss/index.htm
http://www.mvps.org/links.html#Excel

Have fun!!

Ed
 
M

Matthew

Definately - start by recording macros followed by viewing them in the Visual
Basic Editor. I recommend you try recording the desired actions twice, once
in Absolute References and another time using Relative References. Once you
do this and swallow the code line by line, (commenting each one as you
review), you will quickly beon your way.

There really is not too many limitations as to what you can record, copying
and pasting content from 1 sheet to another is quite simple. One hint, to
reference the very last row of the spreadsheet, I use this a lot -

'Save the very last row number to a variable
iLastRow = activecell.specialcells(xllastcell).row.

I can send you more examples if you like.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top