Generally speaking, the quickest and easiest way to put together VB or VBA code to work with an Excel worksheet is to record the action as a macro in Excel. That is, tell Excel to start recording a new macro. Then do whatever-it-is yourself, manually. Then stop recording, and the macro now contains the code to do the task.
To reuse that macro in future probably only requires a little editing, and if you want to create a program in "real" VB, you've got most of it there, ready to just copy over.
|