SlideShare una empresa de Scribd logo
1 de 8
http://www.oobtech.com
VARIABLES
Excel VBA Training
Module 5
http://www.oobtech.com
This chapter teaches you how to declare, initialize and display a
variable in Excel VBA. Letting Excel VBA know you are using a variable
is called declaring a variable. Initializing simply means assigning a
beginning (initial) value to a variable.
Place a command button on your worksheet and add the code lines
below. To execute the code lines, click the command button on the
sheet.
Integer
Integer variable are used to store whole numbers.
Dim x As Integer
x=6
Range(“A1”). Value=x
2
http://www.oobtech.com
3
Result:
Explanation: the first code line declares a variable with name x of type
Integer. Next, we initialize x with value 6. Finally, we write the value of x to
Cell A1.
String
String variable are used to store text.
http://www.oobtech.com
Code:
Dim book As String
book=“bible”
Range(“A1”).Value=book
Result:
4
Explanation: the first code line declares a variable with name book of type
String. Next, we initialize book with the text bible. Always use apostrophes to
Initialize String variables. Finally, we write the text of the variable book to cell
A1.
http://www.oobtech.com
DOUBLE
A variable of type Double is more accurate than a variable of type
Integer and can also store numbers after the comma.
Code:
Dim x As Integer
x=5.5
MsgBox “value is” & x
Result:
5
http://www.oobtech.com
But that is not the right value! We initialized the variable with value 5.5
and we get the value 6. What we need is a variable of type double.
Code:
Dim x As Double
x=5.5
MsgBox “value is” & x
Result:
6
http://www.oobtech.com
Note: Long variables have even larger capacity. Always use variables
of the right type. As a result, errors are easier to find and your code will
run faster.
Boolean
Use a Boolean variable to hold the value True or False.
Code:
Dim continue As Boolean
continue=True
If continue=True then MsgBox “Boolean variables are cool”
7
http://www.oobtech.com
8
Result:
Explanation: the first code line declares a variable with name continue of
type Boolean. Next, we initialize continue with the value True. Finally, we
Use the Boolean variable to only display a MsgBox if the variable holds the
Value True.

Más contenido relacionado

Destacado

How to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideHow to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideIT Tech
 
Packet Tracer 101 course
Packet Tracer 101 coursePacket Tracer 101 course
Packet Tracer 101 courseKenan Spahi
 
Cisco Packet Tracer Overview
Cisco Packet Tracer OverviewCisco Packet Tracer Overview
Cisco Packet Tracer OverviewAli Usman
 
Computer services
Computer servicesComputer services
Computer servicesArz Sy
 
CCNA 200-120 Latest Dumps
CCNA 200-120 Latest DumpsCCNA 200-120 Latest Dumps
CCNA 200-120 Latest Dumpsslotiopo
 
Tips and Tricks of Toad for Oracle 10.6
Tips and Tricks of Toad for Oracle 10.6Tips and Tricks of Toad for Oracle 10.6
Tips and Tricks of Toad for Oracle 10.6Dsunte Wilson
 
Network Engineer Interview Questions with Answers
Network Engineer Interview Questions with Answers Network Engineer Interview Questions with Answers
Network Engineer Interview Questions with Answers Sarmad Ali
 

Destacado (8)

How to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guideHow to configure vlan, stp, dtp step by step guide
How to configure vlan, stp, dtp step by step guide
 
Packet Tracer 101 course
Packet Tracer 101 coursePacket Tracer 101 course
Packet Tracer 101 course
 
Cisco Packet Tracer Overview
Cisco Packet Tracer OverviewCisco Packet Tracer Overview
Cisco Packet Tracer Overview
 
Computer services
Computer servicesComputer services
Computer services
 
CCNA 200-120 Latest Dumps
CCNA 200-120 Latest DumpsCCNA 200-120 Latest Dumps
CCNA 200-120 Latest Dumps
 
Cisco CCNA module 2
Cisco CCNA module 2Cisco CCNA module 2
Cisco CCNA module 2
 
Tips and Tricks of Toad for Oracle 10.6
Tips and Tricks of Toad for Oracle 10.6Tips and Tricks of Toad for Oracle 10.6
Tips and Tricks of Toad for Oracle 10.6
 
Network Engineer Interview Questions with Answers
Network Engineer Interview Questions with Answers Network Engineer Interview Questions with Answers
Network Engineer Interview Questions with Answers
 

Más de Dsunte Wilson

Introduction to oracle primavera
Introduction to oracle primaveraIntroduction to oracle primavera
Introduction to oracle primaveraDsunte Wilson
 
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection Center
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection CenterSYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection Center
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection CenterDsunte Wilson
 
SYMANTEC ENDPOINT PROTECTION Performing Server and Database Management
SYMANTEC ENDPOINT PROTECTION Performing Server and Database ManagementSYMANTEC ENDPOINT PROTECTION Performing Server and Database Management
SYMANTEC ENDPOINT PROTECTION Performing Server and Database ManagementDsunte Wilson
 
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and Reporting
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and ReportingSYMANTEC ENDPOINT PROTECTION Advanced Monitoring and Reporting
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and ReportingDsunte Wilson
 
IBM BladeCenter Fundamentals Introduction
IBM BladeCenter Fundamentals Introduction IBM BladeCenter Fundamentals Introduction
IBM BladeCenter Fundamentals Introduction Dsunte Wilson
 
CCNA Advanced Switching
CCNA Advanced SwitchingCCNA Advanced Switching
CCNA Advanced SwitchingDsunte Wilson
 
CCNA Basic Switching and Switch Configuration Questions
CCNA Basic Switching and Switch Configuration QuestionsCCNA Basic Switching and Switch Configuration Questions
CCNA Basic Switching and Switch Configuration QuestionsDsunte Wilson
 
CCNA PPP and Frame Relay Questions
CCNA PPP and Frame Relay QuestionsCCNA PPP and Frame Relay Questions
CCNA PPP and Frame Relay QuestionsDsunte Wilson
 
CCNA Network Services Questions
CCNA Network Services QuestionsCCNA Network Services Questions
CCNA Network Services QuestionsDsunte Wilson
 
CCNA Basic Switching and Switch Configuration
CCNA Basic Switching and Switch ConfigurationCCNA Basic Switching and Switch Configuration
CCNA Basic Switching and Switch ConfigurationDsunte Wilson
 
CCNA PPP and Frame Relay
CCNA PPP and Frame RelayCCNA PPP and Frame Relay
CCNA PPP and Frame RelayDsunte Wilson
 
CCNA Network Services
CCNA Network ServicesCCNA Network Services
CCNA Network ServicesDsunte Wilson
 
CCNA Advanced Routing Protocols Questions
CCNA Advanced Routing Protocols QuestionsCCNA Advanced Routing Protocols Questions
CCNA Advanced Routing Protocols QuestionsDsunte Wilson
 
CCNA Routing Protocols Questions
CCNA Routing Protocols QuestionsCCNA Routing Protocols Questions
CCNA Routing Protocols QuestionsDsunte Wilson
 
CCNA Router and IOS Basics Questions
CCNA Router and IOS Basics QuestionsCCNA Router and IOS Basics Questions
CCNA Router and IOS Basics QuestionsDsunte Wilson
 
CCNA Advanced Routing Protocols
CCNA Advanced Routing ProtocolsCCNA Advanced Routing Protocols
CCNA Advanced Routing ProtocolsDsunte Wilson
 
CCNA Routing Protocols
CCNA Routing ProtocolsCCNA Routing Protocols
CCNA Routing ProtocolsDsunte Wilson
 
CCNA Router Startup and Configuration
CCNA Router Startup and ConfigurationCCNA Router Startup and Configuration
CCNA Router Startup and ConfigurationDsunte Wilson
 
CCNA Router and IOS Basics
CCNA Router and IOS BasicsCCNA Router and IOS Basics
CCNA Router and IOS BasicsDsunte Wilson
 

Más de Dsunte Wilson (20)

Introduction to oracle primavera
Introduction to oracle primaveraIntroduction to oracle primavera
Introduction to oracle primavera
 
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection Center
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection CenterSYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection Center
SYMANTEC ENDPOINT PROTECTION Interfacing the SEPM with Protection Center
 
SYMANTEC ENDPOINT PROTECTION Performing Server and Database Management
SYMANTEC ENDPOINT PROTECTION Performing Server and Database ManagementSYMANTEC ENDPOINT PROTECTION Performing Server and Database Management
SYMANTEC ENDPOINT PROTECTION Performing Server and Database Management
 
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and Reporting
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and ReportingSYMANTEC ENDPOINT PROTECTION Advanced Monitoring and Reporting
SYMANTEC ENDPOINT PROTECTION Advanced Monitoring and Reporting
 
IBM BladeCenter Fundamentals Introduction
IBM BladeCenter Fundamentals Introduction IBM BladeCenter Fundamentals Introduction
IBM BladeCenter Fundamentals Introduction
 
CCNA Advanced Switching
CCNA Advanced SwitchingCCNA Advanced Switching
CCNA Advanced Switching
 
CCNA Basic Switching and Switch Configuration Questions
CCNA Basic Switching and Switch Configuration QuestionsCCNA Basic Switching and Switch Configuration Questions
CCNA Basic Switching and Switch Configuration Questions
 
CCNA PPP and Frame Relay Questions
CCNA PPP and Frame Relay QuestionsCCNA PPP and Frame Relay Questions
CCNA PPP and Frame Relay Questions
 
CCNA Network Services Questions
CCNA Network Services QuestionsCCNA Network Services Questions
CCNA Network Services Questions
 
CCNA Basic Switching and Switch Configuration
CCNA Basic Switching and Switch ConfigurationCCNA Basic Switching and Switch Configuration
CCNA Basic Switching and Switch Configuration
 
CCNA PPP and Frame Relay
CCNA PPP and Frame RelayCCNA PPP and Frame Relay
CCNA PPP and Frame Relay
 
CCNA Access Lists
CCNA Access ListsCCNA Access Lists
CCNA Access Lists
 
CCNA Network Services
CCNA Network ServicesCCNA Network Services
CCNA Network Services
 
CCNA Advanced Routing Protocols Questions
CCNA Advanced Routing Protocols QuestionsCCNA Advanced Routing Protocols Questions
CCNA Advanced Routing Protocols Questions
 
CCNA Routing Protocols Questions
CCNA Routing Protocols QuestionsCCNA Routing Protocols Questions
CCNA Routing Protocols Questions
 
CCNA Router and IOS Basics Questions
CCNA Router and IOS Basics QuestionsCCNA Router and IOS Basics Questions
CCNA Router and IOS Basics Questions
 
CCNA Advanced Routing Protocols
CCNA Advanced Routing ProtocolsCCNA Advanced Routing Protocols
CCNA Advanced Routing Protocols
 
CCNA Routing Protocols
CCNA Routing ProtocolsCCNA Routing Protocols
CCNA Routing Protocols
 
CCNA Router Startup and Configuration
CCNA Router Startup and ConfigurationCCNA Router Startup and Configuration
CCNA Router Startup and Configuration
 
CCNA Router and IOS Basics
CCNA Router and IOS BasicsCCNA Router and IOS Basics
CCNA Router and IOS Basics
 

Último

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Último (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Excel VBA Variable Training

  • 2. http://www.oobtech.com This chapter teaches you how to declare, initialize and display a variable in Excel VBA. Letting Excel VBA know you are using a variable is called declaring a variable. Initializing simply means assigning a beginning (initial) value to a variable. Place a command button on your worksheet and add the code lines below. To execute the code lines, click the command button on the sheet. Integer Integer variable are used to store whole numbers. Dim x As Integer x=6 Range(“A1”). Value=x 2
  • 3. http://www.oobtech.com 3 Result: Explanation: the first code line declares a variable with name x of type Integer. Next, we initialize x with value 6. Finally, we write the value of x to Cell A1. String String variable are used to store text.
  • 4. http://www.oobtech.com Code: Dim book As String book=“bible” Range(“A1”).Value=book Result: 4 Explanation: the first code line declares a variable with name book of type String. Next, we initialize book with the text bible. Always use apostrophes to Initialize String variables. Finally, we write the text of the variable book to cell A1.
  • 5. http://www.oobtech.com DOUBLE A variable of type Double is more accurate than a variable of type Integer and can also store numbers after the comma. Code: Dim x As Integer x=5.5 MsgBox “value is” & x Result: 5
  • 6. http://www.oobtech.com But that is not the right value! We initialized the variable with value 5.5 and we get the value 6. What we need is a variable of type double. Code: Dim x As Double x=5.5 MsgBox “value is” & x Result: 6
  • 7. http://www.oobtech.com Note: Long variables have even larger capacity. Always use variables of the right type. As a result, errors are easier to find and your code will run faster. Boolean Use a Boolean variable to hold the value True or False. Code: Dim continue As Boolean continue=True If continue=True then MsgBox “Boolean variables are cool” 7
  • 8. http://www.oobtech.com 8 Result: Explanation: the first code line declares a variable with name continue of type Boolean. Next, we initialize continue with the value True. Finally, we Use the Boolean variable to only display a MsgBox if the variable holds the Value True.