![]() |
|
|
FlashChat | Actuarial Discussion | Preliminary Exams | CAS/SOA Exams | Cyberchat | Around the World | Suggestions |
View Poll Results: What is the best way to learn VBA? | |||
Book |
![]() ![]() ![]() ![]() |
110 | 35.48% |
Help |
![]() ![]() ![]() ![]() |
48 | 15.48% |
Internet |
![]() ![]() ![]() ![]() |
156 | 50.32% |
Macro Recorder |
![]() ![]() ![]() ![]() |
119 | 38.39% |
Multiple Choice Poll. Voters: 310. You may not vote on this poll |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
![]() I'll rank my choices.
1. Good book. Any of the VBA books by Walkebach will do. This will help you write clean, readable code. 2. VBA Help files. Type what you want to do in help. They have some good examples. 3. Internet. Google it or post your question on a discussion board. Avoid the macro recorder until you have honed your skills. It writes sloppy code and there is no macro recorder in Access. |
#2
|
||||
|
||||
![]() For those voting for macro recorder, can you say why you believe it's a good way to LEARN vba? I agree it's a good tool for those who already have a good foundation in vba, but to use it as a learning tool is just not smart IMO.
For example, I couldn't find how to change the datasource from the Object Browser or help files, but a quick record of creating a pivot table lead me to the solution. |
#3
|
||||
|
||||
![]() For example, if someone was to learn using the macro recorder then .Select would be all throughout their code. They wouldn't learn how to declare variables, create functions, or useful things like Cells(row, column). I could go on and on.
|
#4
|
||||
|
||||
![]() Another way to learn how to code is to have lots of deadlines at work. That way your livelihood (sp?) depends on figuring it out and fast.
|
#5
|
||||
|
||||
![]() In addition, write a ton of experimental code to see
(1) what it does, (2) what it does NOT do, (3) what unexpected things it does. Then find ways to modify that code to make it stable and practical, yet be self-explanatory as possible with good commentary where needed. Brad
__________________
Brad Gile, FSA, MAAA Affiliate Member of the CAS Dedicated Retired Actuary Spoiler: Spoiler: |
#6
|
||||
|
||||
![]() whisper, why do you consider the macro recorder a good learning tool for vba? This is a sincere question. You've contributed to many a VBA questions over the years on this forum.
|
#7
|
||||
|
||||
![]() Quote:
No one has said you should record a macro and leave it at that. What they (or at least I) have said is that it often gives you a good place to start. A person who knows his or her way around Excel and is smart enough to be an Actuary who sees: Code:
Range("A1:A10").Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _ SkipBlanks:=False, Transpose:=False As for the lack of a recorder in Access, the any VBA you learn [b]will[/i] transfer, regardless of how you aquired the knowledge. And since Actuaries tend to spend more time in Excel than they do Access, they will also tend to learn their VBA in Excel first. So it's not usually going to be a problem.
__________________
I've never heard of such a brutal and shocking injustice that I cared so little about. |
#8
|
||||
|
||||
![]() Quote:
I've actually used the recorder recently to try to figure out how to do something because I knew the recorder was so verbose that somewhere in the code it had what I wanted, I just had to read it and figure out what that one thing was. |
#9
|
||||
|
||||
![]() That's where the "Actuaries are smart" part comes in. When has anyone ever suggested that you're finished when you hit "Stop Recording"?
__________________
I've never heard of such a brutal and shocking injustice that I cared so little about. |
#10
|
||||
|
||||
![]() Quote:
When I first started VBA programming I was already pretty good in VB. I used the macro recorder to learn the excel specific stuff at first and I was writing code like: dim i as integer for i = 1 to 10 range("A"&i).select activecell.value = i next i Columns were of course a *****. I knew there had to be a better way so I bought a book and of course started writing better code immediately. Can you learn from the macro recorder? Of course. Is is the BEST way to learn? Hell no. Even for the best programmer in the world, he'd be better off scanning a book, then recording stuff. |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|