SlideShare a Scribd company logo
Debugging Tools
Debug Macros:-
You may have heard of the technique called debugging before. With
this technique you can find errors in your Excel VBA code before
you execute the code. To show you how to debug a macro, execute
the following steps.
1. Launch the Visual Basic Editor.
2. Create the following incorrect macro:
Incorrect Macro Code.
3. Place your cursor before Private.
4. There are two ways to debug a macro.
 Press F8
or
 Go to Debug Menu and click on Step Into.
Debug your macro. The first line will turn yellow.
5. Press F8 again. The second code line will turn yellow. As long as the
debugger thinks everything is okay, nothing will happen.
6. Press F8 twice. The following error will show up
7. It says that the object doesn't support the property or method.
The Range object has a property called Value. Value isn't spelled
correctly here, so the debugger doesn't recognize the property.
The various debugging resources
available in the VBA Editor
• The Immediate Window is a window in the VBE in which you can enter
commands and view and change the contents of variables while you code
is in Break mode or when no macro code is executing.
• To display the Immediate Window:
– Press CTRL+G
Or
– Choose it from the View menu.
• In the Immediate Window, you can display the value of a variable by using
the “? “command.
Simply type ? followed by the variable name and press Enter.
VBA will display the contents of the variable in the Immediate Window.
Immediate Window
For example:-
?ActiveCell.Address
$A$10
You can also execute VBA commands in the Immediate Window by omitting
the question mark and entering the command followed by the Enter key:
Application.EnableEvents=True
or
Range("A1").Value = 1234
• The Immediate Window won't let you enter VBA code snippets and
execute them together because the Immediate Windows executes what
you enter when you press the Enter key.
• However, you can combine several "logical" lines of code in to a single
"physical" line of code using the ':' character, and execute this entire
command.
Example:-
First we record a simple macro to print random no’s between 1
to 10. and create a chart of that data.
Developer tab
Start
Recording
Select the range A1 to F5
Type formula
=rand()*10
1
2
3
4
Click on Insert
Menu.
Click on Charts
Click on 3-D
column Chart.
Chart will appears on sheet.
Click on Stop Button
• Now Open the VBE(Press Alt+F11 on excel sheet).
• It shows all coding.
Now we see the working of Immediate window
•Go to View Menu Click on Immediate window.
OR
•Press Ctrl+G
Now we Execute some code by using immediate window.(VBE allows us to
execute VBA code line by line.)
Type code and press Enter it
Shows the O/P. on Excel sheet.
• We execute one more code.
Code in Immediate window
is to Add 3-D chart in Excel
sheet
It Shows random
no’s between 1 to
10
Break Points:-
• A break point is a setting on a line of code that tells VBA to pause
execution immediately before that line of code is executed. Code
execution is placed in what is called break mode.
When VBA is in break mode, you can enter commands in to the
Immediate Window to display or change the values of variables.
To put a break point on a line of code:-
Place the cursor on that line and press F9
or
Choose "Toggle Breakpoint" from the Debug menu.
To remove a break point:-
Place the cursor on that line and press F9
or
Choose "Toggle Breakpoint" from the Debug menu.
When a line contains a break point, it is displayed with a brick
colored background. Immediately before this line of code is
executed, it will appear with a yellow background. Remember, when
a break point is encountered, code execution is paused but that line
of code has not yet executed.
You cannot place break points on blank lines, comment lines, or
variable declaration lines (lines with Dimstatements).
After a break point is encountered, you can resume normal code
execution by pressing F5 or choosing "Continue" from the Run
menu.
**Note that break points are not saved in the workbook file. If you
close the file, all break points are removed. Breakpoints are
preserved as long as the file is open.
Stepping Through Code:-
Normally, your code runs unattended. It executes until its logical
end. However, when you are testing code, it is often useful to step
through the code line by line, watching each line of code take effect.
This makes it easy to determine exactly what line is causing incorrect
behavior.
You can step through code line by line:-
Press F8 key to start the procedure in which the cursor is, or
when VBA is paused at a break point.
 Pressing F8 causes VBA to execute each line one at a time.
 Highlighting the next line of code in yellow.
Note, the highlighted line is the line of code that will execute when
you press F8. It has not yet been executed.
• If your procedure calls another procedure, pressing F8 will cause
VBA to step inside that procedure and execute it line by line.
• You can use SHIFT+F8 to "Step Over" the procedure call. This
means that the entire called procedure is executed as one line of
code. This can make debugging simpler if you are confident that
the problem does not lie within a called procedure.
• When you are in a called procedure, you can use CTRL+SHIFT+F8 to
"Step Out" of the current procedure. This causes VBA to execute
until the end of the procedure is reached (an End Sub or Exit
Sub statement) and then stop at the line of code immediately
following the line which called the procedure.
Watch Window:-
• The Watch Window allows you to "watch" a specific variable or
expression and cause code execution to pause and enter break
mode when the value of that variable or expression is True (non-
zero) or whenever that variable is changed.
• To display the Watch Window,
– Choose it from the View menu.
• To create a new watch,
– Choose Add Watch from the Debug menu.
This will display the Add Watch window, shown below.
VISUAL

More Related Content

What's hot

Access tips access and sql part 6 dynamic reports
Access tips  access and sql part 6  dynamic reportsAccess tips  access and sql part 6  dynamic reports
Access tips access and sql part 6 dynamic reports
quest2900
 
Learn Excel Macro
Learn Excel Macro  Learn Excel Macro
Learn Excel Macro
AbhisheK Kumar Rajoria
 
Vba
Vba Vba
E learning excel vba programming lesson 2
E learning excel vba programming  lesson 2E learning excel vba programming  lesson 2
E learning excel vba programming lesson 2
Vijay Perepa
 
Updating the UC TCA using Adobe
Updating the UC TCA using AdobeUpdating the UC TCA using Adobe
Updating the UC TCA using Adobe
coatransfer
 
Vba introduction
Vba introductionVba introduction
Vba introduction
Sandesh DJSAS Singh
 
Programming Environment in Matlab
Programming Environment in MatlabProgramming Environment in Matlab
Programming Environment in Matlab
DataminingTools Inc
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Glenn Gutmacher
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual
kamesh dagia
 

What's hot (9)

Access tips access and sql part 6 dynamic reports
Access tips  access and sql part 6  dynamic reportsAccess tips  access and sql part 6  dynamic reports
Access tips access and sql part 6 dynamic reports
 
Learn Excel Macro
Learn Excel Macro  Learn Excel Macro
Learn Excel Macro
 
Vba
Vba Vba
Vba
 
E learning excel vba programming lesson 2
E learning excel vba programming  lesson 2E learning excel vba programming  lesson 2
E learning excel vba programming lesson 2
 
Updating the UC TCA using Adobe
Updating the UC TCA using AdobeUpdating the UC TCA using Adobe
Updating the UC TCA using Adobe
 
Vba introduction
Vba introductionVba introduction
Vba introduction
 
Programming Environment in Matlab
Programming Environment in MatlabProgramming Environment in Matlab
Programming Environment in Matlab
 
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atlGutmacher practical-coding-examples-for-sourcers-sc18 atl
Gutmacher practical-coding-examples-for-sourcers-sc18 atl
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual
 

Similar to VISUAL

debugging-for-functional-consultants_compress.pdf
debugging-for-functional-consultants_compress.pdfdebugging-for-functional-consultants_compress.pdf
debugging-for-functional-consultants_compress.pdf
ssuserd257fb
 
Macros
MacrosMacros
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeans
Huu Bang Le Phan
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vb
Salim M
 
VBA Tips
VBA TipsVBA Tips
VBA Tips
Ike Onwubuya
 
2 front panel
2  front panel2  front panel
2 front panel
Ankush Jamthikar
 
Excel vba
Excel vbaExcel vba
Excel vba
Almeda Asuncion
 
Excel VBA.pptx
Excel VBA.pptxExcel VBA.pptx
Excel VBA.pptx
GiyaShefin
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1
rupeshkanu
 
Learn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in DelhiLearn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in Delhi
ibinstitute0
 
Visual Logic User Guide
Visual Logic User GuideVisual Logic User Guide
Visual Logic User Guide
Programming Techniques and Algorithms
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
paynetawnya
 
Tugas testing
Tugas testingTugas testing
Tugas testing
Astrid yolanda
 
Basic Debugging
Basic DebuggingBasic Debugging
Basic Debugging
Sathish Kumar G
 
Abapdebuggingfrombasictoadvance 140214043218-phpapp01
Abapdebuggingfrombasictoadvance 140214043218-phpapp01Abapdebuggingfrombasictoadvance 140214043218-phpapp01
Abapdebuggingfrombasictoadvance 140214043218-phpapp01
IT TRAINER
 
Online Advance Excel & VBA Training in India
 Online Advance Excel & VBA Training in India Online Advance Excel & VBA Training in India
Online Advance Excel & VBA Training in India
ibinstitute0
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
Mohammed Saleh
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
Mohammed Saleh
 
Introduction To Excel 2007 Macros
Introduction To Excel 2007 MacrosIntroduction To Excel 2007 Macros
Introduction To Excel 2007 Macros
Excel
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vba
rjg_vijay
 

Similar to VISUAL (20)

debugging-for-functional-consultants_compress.pdf
debugging-for-functional-consultants_compress.pdfdebugging-for-functional-consultants_compress.pdf
debugging-for-functional-consultants_compress.pdf
 
Macros
MacrosMacros
Macros
 
Debugger & Profiler in NetBeans
Debugger & Profiler in NetBeansDebugger & Profiler in NetBeans
Debugger & Profiler in NetBeans
 
Error handling and debugging in vb
Error handling and debugging in vbError handling and debugging in vb
Error handling and debugging in vb
 
VBA Tips
VBA TipsVBA Tips
VBA Tips
 
2 front panel
2  front panel2  front panel
2 front panel
 
Excel vba
Excel vbaExcel vba
Excel vba
 
Excel VBA.pptx
Excel VBA.pptxExcel VBA.pptx
Excel VBA.pptx
 
Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1Excel Vba Basic Tutorial 1
Excel Vba Basic Tutorial 1
 
Learn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in DelhiLearn VBA Training & Advance Excel Courses in Delhi
Learn VBA Training & Advance Excel Courses in Delhi
 
Visual Logic User Guide
Visual Logic User GuideVisual Logic User Guide
Visual Logic User Guide
 
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
10.USING THE ECLIPSE DEBUGGERupdated 8618This t.docx
 
Tugas testing
Tugas testingTugas testing
Tugas testing
 
Basic Debugging
Basic DebuggingBasic Debugging
Basic Debugging
 
Abapdebuggingfrombasictoadvance 140214043218-phpapp01
Abapdebuggingfrombasictoadvance 140214043218-phpapp01Abapdebuggingfrombasictoadvance 140214043218-phpapp01
Abapdebuggingfrombasictoadvance 140214043218-phpapp01
 
Online Advance Excel & VBA Training in India
 Online Advance Excel & VBA Training in India Online Advance Excel & VBA Training in India
Online Advance Excel & VBA Training in India
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Introduction To Excel 2007 Macros
Introduction To Excel 2007 MacrosIntroduction To Excel 2007 Macros
Introduction To Excel 2007 Macros
 
Autocad excel vba
Autocad excel vbaAutocad excel vba
Autocad excel vba
 

Recently uploaded

RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 

Recently uploaded (20)

RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 

VISUAL

  • 2. Debug Macros:- You may have heard of the technique called debugging before. With this technique you can find errors in your Excel VBA code before you execute the code. To show you how to debug a macro, execute the following steps. 1. Launch the Visual Basic Editor. 2. Create the following incorrect macro:
  • 4. 3. Place your cursor before Private. 4. There are two ways to debug a macro.  Press F8 or  Go to Debug Menu and click on Step Into. Debug your macro. The first line will turn yellow.
  • 5. 5. Press F8 again. The second code line will turn yellow. As long as the debugger thinks everything is okay, nothing will happen. 6. Press F8 twice. The following error will show up 7. It says that the object doesn't support the property or method. The Range object has a property called Value. Value isn't spelled correctly here, so the debugger doesn't recognize the property.
  • 6. The various debugging resources available in the VBA Editor
  • 7. • The Immediate Window is a window in the VBE in which you can enter commands and view and change the contents of variables while you code is in Break mode or when no macro code is executing. • To display the Immediate Window: – Press CTRL+G Or – Choose it from the View menu. • In the Immediate Window, you can display the value of a variable by using the “? “command. Simply type ? followed by the variable name and press Enter. VBA will display the contents of the variable in the Immediate Window. Immediate Window
  • 8. For example:- ?ActiveCell.Address $A$10 You can also execute VBA commands in the Immediate Window by omitting the question mark and entering the command followed by the Enter key: Application.EnableEvents=True or Range("A1").Value = 1234 • The Immediate Window won't let you enter VBA code snippets and execute them together because the Immediate Windows executes what you enter when you press the Enter key. • However, you can combine several "logical" lines of code in to a single "physical" line of code using the ':' character, and execute this entire command.
  • 9. Example:- First we record a simple macro to print random no’s between 1 to 10. and create a chart of that data. Developer tab Start Recording Select the range A1 to F5 Type formula =rand()*10 1 2 3 4
  • 10. Click on Insert Menu. Click on Charts Click on 3-D column Chart.
  • 11. Chart will appears on sheet. Click on Stop Button
  • 12. • Now Open the VBE(Press Alt+F11 on excel sheet). • It shows all coding. Now we see the working of Immediate window •Go to View Menu Click on Immediate window. OR •Press Ctrl+G
  • 13. Now we Execute some code by using immediate window.(VBE allows us to execute VBA code line by line.) Type code and press Enter it Shows the O/P. on Excel sheet.
  • 14. • We execute one more code. Code in Immediate window is to Add 3-D chart in Excel sheet It Shows random no’s between 1 to 10
  • 15. Break Points:- • A break point is a setting on a line of code that tells VBA to pause execution immediately before that line of code is executed. Code execution is placed in what is called break mode. When VBA is in break mode, you can enter commands in to the Immediate Window to display or change the values of variables. To put a break point on a line of code:- Place the cursor on that line and press F9 or Choose "Toggle Breakpoint" from the Debug menu. To remove a break point:- Place the cursor on that line and press F9 or Choose "Toggle Breakpoint" from the Debug menu.
  • 16. When a line contains a break point, it is displayed with a brick colored background. Immediately before this line of code is executed, it will appear with a yellow background. Remember, when a break point is encountered, code execution is paused but that line of code has not yet executed. You cannot place break points on blank lines, comment lines, or variable declaration lines (lines with Dimstatements). After a break point is encountered, you can resume normal code execution by pressing F5 or choosing "Continue" from the Run menu. **Note that break points are not saved in the workbook file. If you close the file, all break points are removed. Breakpoints are preserved as long as the file is open.
  • 17. Stepping Through Code:- Normally, your code runs unattended. It executes until its logical end. However, when you are testing code, it is often useful to step through the code line by line, watching each line of code take effect. This makes it easy to determine exactly what line is causing incorrect behavior. You can step through code line by line:- Press F8 key to start the procedure in which the cursor is, or when VBA is paused at a break point.  Pressing F8 causes VBA to execute each line one at a time.  Highlighting the next line of code in yellow. Note, the highlighted line is the line of code that will execute when you press F8. It has not yet been executed.
  • 18. • If your procedure calls another procedure, pressing F8 will cause VBA to step inside that procedure and execute it line by line. • You can use SHIFT+F8 to "Step Over" the procedure call. This means that the entire called procedure is executed as one line of code. This can make debugging simpler if you are confident that the problem does not lie within a called procedure. • When you are in a called procedure, you can use CTRL+SHIFT+F8 to "Step Out" of the current procedure. This causes VBA to execute until the end of the procedure is reached (an End Sub or Exit Sub statement) and then stop at the line of code immediately following the line which called the procedure.
  • 19. Watch Window:- • The Watch Window allows you to "watch" a specific variable or expression and cause code execution to pause and enter break mode when the value of that variable or expression is True (non- zero) or whenever that variable is changed. • To display the Watch Window, – Choose it from the View menu. • To create a new watch, – Choose Add Watch from the Debug menu. This will display the Add Watch window, shown below.