Excel VBA - 4th Session End Sub Sub macro1()
Declaring Variables A Variable is used to store temporary information that is used for execution within the Procedure, Module or Workbook. Before we go into some detail of Variables, there are a few important rules that you must know about. • A Variable name must Start with a letter and not a number. Numbers can be included within the name, but not as the first character. • A Variable name can be no longer than 255 characters. • A Variable name cannot be the same as any one of Excel's key words. In other words you cannot name a Variable with such names as Sheet, Worksheet etc. • All Variables must consist of one continuous string of characters only. You can separate words by either capitalising the first letter of each word, or by using the underscore characters if you prefer.
List of Data Types
Byte Data Type Byte is VBA's smallest numeric data type and holds a (natural) numeric value from 0 to 255. In this data type only positive numbers to be used. Otherwise VBA will return with an error. Example for Byte Data Type : Sub atz() Dim Value As Byte Value = 246 End Sub We are going discuss more about Byte and cbyte() in future lessons
AmeetZ Academy For Complete PPT, visit www.ameetz.com Or write to rama@ameetz.com

E learning excel vba programming lesson 4

  • 1.
    Excel VBA - 4th Session End Sub Sub macro1()
  • 2.
    Declaring Variables A Variable is used to store temporary information that is used for execution within the Procedure, Module or Workbook. Before we go into some detail of Variables, there are a few important rules that you must know about. • A Variable name must Start with a letter and not a number. Numbers can be included within the name, but not as the first character. • A Variable name can be no longer than 255 characters. • A Variable name cannot be the same as any one of Excel's key words. In other words you cannot name a Variable with such names as Sheet, Worksheet etc. • All Variables must consist of one continuous string of characters only. You can separate words by either capitalising the first letter of each word, or by using the underscore characters if you prefer.
  • 3.
  • 4.
    Byte Data Type Byte is VBA's smallest numeric data type and holds a (natural) numeric value from 0 to 255. In this data type only positive numbers to be used. Otherwise VBA will return with an error. Example for Byte Data Type : Sub atz() Dim Value As Byte Value = 246 End Sub We are going discuss more about Byte and cbyte() in future lessons
  • 5.
    AmeetZ Academy For CompletePPT, visit www.ameetz.com Or write to rama@ameetz.com