Here is my intro to VBA for you:
The programming language used in creating Excel macros is known as VBA (Visual Basic for Applications).
To open the macro editor / VBA editor, from Excel, press Alt-F11.
The building blocks of a macro are known as functions and procedures. Functions can do all the same things + more than what procedures can do, so I always use functions, unless a procedure is explicity required.
To get to where you can type in or paste in a general function or procedure, click Insert --> Module. To start a function, type the following line:
function myFunction
Then press Enter. It should automatically put () after your function name for you, and create an "End Function" line for you.
If you want or need to use a procedure instead of a function for any reason, instead of typing "function", type "sub"- like this-
sub myProcedure
and press Enter. Now you're ready to start coding in VBA. Now if you ever find any code in an internet search and try it out, you can copy and paste that code into your function or procedure (if it already has a "function ...()" or a "sub ...()" starting line then you don't need to type your own).
To execute a procedure or function, just click anywhere inside that procedure or function and then press F5.
EVENTS
Events are another very important thing to understand- Excel calls certain procedures that are named a certain way whenever certain events are called. Example- if you want certain code to run whenever someone changes something on sheet 1, then put that code inside the Sheet1 module, into a procedure named Worksheet_Change. Your "sub" line starting the procedure has to look like this-
Private Sub Worksheet_Change(ByVal Target As Range)
(Actually it doesn't necessarily have to be private, but you can learn more about that later)
The part inside the parentheses is a declaration of "parameters" that the procedure can use. There's just one parameter here- named Target. The "ByVal" means the parameter is passed "by value"- again, you can learn more about that later- not real important right now. the "As Range" is telling you the data type of the parameter variable- Range. For this procedure, this parameter tells you which cell, or range or cells, was changed. So your code can check what cell it was and/or what value it changed to, and take action based on that. Here's an example of how to do that :
Code:
if target.cells(1,1) <> "" and target.cells(1,2) <> "" and target.cells(1,3) <> "" then
msgbox "Columns A, B, and C have been filled in."
end if
Now you can go ahead and try doing an internet search for things like "excel vba send email"- let us know if you have questions about what you find.