I've got kind of a general question. I've been reviewing this message board for the last few weeks and also trying to read a little about using VBA from various books. However, it's SLOWLY sinking in, way too slowly. I do have programming background and have done many similar things before with other languages. However, I'm having trouble seeing exact parallels in order to write the necessary VBA code that "works" in an efficient, effective manner.
I need some recommendations that would provide some fundamental knowledge that would help me better interpret code in many of these messages as well as allow me to "start easier" in writing my own routines. I can usually interpret most of the code in most of the messages on the Excel/VBA board, but I can't seem to get to a level yet where I can begin from scratch to write the necessary code to do something sometimes that even seems simple (at least in my mind). Some of the initial phases/activities I seem to have trouble with are:
1. How to assign values to a variable you create? (What should be the syntax of the command? Should I use "Set"? When to use "="? How to combine text and the value of a function or other variable? Etc.)
2. How to know which property/attribute to use in your commands to do what you want to do? (Is there a generalized command structure/naming convention that will help me make this decision or is it simply becoming familiar with as many different ones as possible and knowing how they're used? For example, how do I rename a worksheet using a combination of text and the current date function? How can I make a pivot table refer to a spreadsheet in a generalized way rather than specifically by the spreadsheet name, e.g., base the pivot table on the 3rd spreadsheet in the workbook?)
3. Are there some basic generalized principles and/or naming conventions that could provide a foundation for getting all this to make sense and guide someone in developing their own code? It just seems like each code solution I see has some basic structure (e.g., define dims, assign values, do loops, error handling), however, to determine what specifically goes in each of those sections to address what you want to do seems to vary all over the book and often results in something that is not clearly evident much less something that you could create yourself without a thorough knowledge of every specific property used in the code.
I would really appreciate some experienced guidance and tips on this one. I don't mind working at this, but I need a better way than what I've been doing.
Thanks.