Top Banner
VBA NOTES The VBA toolbar 1. Opening The VBA Editor 2. Opening an Edit window 3. The First and Last Line 4. Using Comments 5. Making a Run Button 1 6. Making a Run Button 2 7. Renaming an Excel Sheet 8. Declaring Variables 9. Transferring Data between VBA and Excel Using sheet-cell format 10. Transferring Data between VBA and Excel Using Named Cells 11. The For Loop 12. If Then Else 13. The GOTO 14. Syntax Errors 15. Run Time Errors 16. Array Variables 17. Subroutines 18. Use of Forms 19. Do While 20. Do Until 21. Page Prepared by Vaughan R. Voller Civil Engineering | Institute of Technology | University of Minnesota VBA Notes file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/vba_notes.html [2/13/2003 11:01:16 AM]
19

VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

May 09, 2018

Download

Documents

phamcong
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

VBA NOTES

The VBA toolbar1. Opening The VBA Editor2. Opening an Edit window3. The First and Last Line4. Using Comments5. Making a Run Button 16. Making a Run Button 27. Renaming an Excel Sheet8. Declaring Variables9. Transferring Data between VBA and ExcelUsing sheet-cell format

10.

Transferring Data between VBA and ExcelUsing Named Cells

11.

The For Loop12. If Then Else13. The GOTO14. Syntax Errors15. Run Time Errors16. Array Variables17. Subroutines18. Use of Forms19. Do While20. Do Until21.

Page Prepared by Vaughan R. Voller

Civil Engineering | Institute of Technology | University of Minnesota

VBA Notes

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/vba_notes.html [2/13/2003 11:01:16 AM]

Page 2: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/toolbar.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/toolbar.gif [2/13/2003 11:01:24 AM]

Page 3: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/switch.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/switch.gif [2/13/2003 11:01:32 AM]

Page 4: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/edit.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/edit.gif [2/13/2003 11:01:40 AM]

Page 5: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/first_last.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/first_last.gif [2/13/2003 11:01:44 AM]

Page 6: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/comments.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/comments.gif [2/13/2003 11:01:48 AM]

Page 7: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_button.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_button.gif [2/13/2003 11:02:15 AM]

Page 8: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_button2.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_button2.gif [2/13/2003 11:02:19 AM]

Page 9: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/rename.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/rename.gif [2/13/2003 11:02:23 AM]

Page 10: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/variable.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/variable.gif [2/13/2003 11:02:26 AM]

Page 11: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/data_transfer.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/data_transfer.gif [2/13/2003 11:02:35 AM]

Page 12: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/data_transfer1.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/data_transfer1.gif [2/13/2003 11:02:41 AM]

Page 13: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/for_loop.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/for_loop.gif [2/13/2003 11:02:47 AM]

Page 14: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/if_then_else.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/if_then_else.gif [2/13/2003 11:02:50 AM]

Page 15: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/goto.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/goto.gif [2/13/2003 11:02:54 AM]

Page 16: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/syntax.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/syntax.gif [2/13/2003 11:03:08 AM]

Page 17: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_time.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/run_time.gif [2/13/2003 11:03:12 AM]

Page 18: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/array.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/array.gif [2/13/2003 11:03:17 AM]

Page 19: VBA NOTES 1. The VBA toolbar - University of Minnesotapersonal.cege.umn.edu/~voller/ise_5113/vba/vbanotes.pdfVBA NOTES 1. The VBA toolbar 2. Opening The VBA Editor 3. Opening an Edit

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/subroutine.gif

file:///C|/WINDOWS/DESKTOP/CE3101~1/CE3101/VBA/VBA_NO~1/subroutine.gif [2/13/2003 11:03:22 AM]