Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » » Deceleration of variable in VBA

What is Variable?
A Variable is a name given by users to assign a piece of data that is stored inside computer’s memory.Variables hold values of different data types that are specified when the variable is declared. Deceleration of variable includes four keywords in a particular order:
1. The Dim statement (VBA’s abbreviation for “Dimension”)
2. The name of your variable, which you create, such as vals_name
3. The word As.
4. The type of data being stored.[datatypes]
Like-
Dim vals_name As String
or
Dim vals_name1 as Integer, vals_name2 as Integer, vals_name3 as Integer
or
Dim vals_name1, vals_name2, vals_name3 as Integer
Assignment is very simple--
vals_name= Application.ActiveWorkbook.Worksheets(“Sheet1”).Range(“A1”).Value
or else
vals_name= Worksheets(“Sheet1”).Range(“A1”).Value  [it automatically assume current application and current Workbook]
 

«
Next
Newer Post
»
Previous
Older Post

2 comments:

  1. Hi Animesh da this is Sourav Mukhopadhyay
    Am struck while writing a macro.
    Situation:-
    I want to write a code where a column will randomly select values from a give range. (Values are FPO,None, 10% Compound,20% Off)...>Can you please help me out of this.

    ReplyDelete
  2. Hi Sourav,
    take 1st 5 cel values from user
    put this an array
    now take one element from this array
    now do a random no generation (101>number>0)
    take no number in the list
    check the number is in the list

    so when an random value is generated -->it will check the values in the list--> if it not there insert the array element to the random place. do this loop for 20 times.
    So this way you can generate 20*5 =100 test data generated

    ReplyDelete