Question

(VBA Coding Simple Questions) Please write the syntax for: a) how to write a sub b)...

(VBA Coding Simple Questions) Please write the syntax for:

a) how to write a sub

b) a function

c) how to reference a given element in an array,

d) how to write the different types of loops (syntax) for next, do while, do until

e) format for a VBA If statement then

f) format for a VBA If statement then else

g) for generating a random value

h) setting the range

0 0
Add a comment Improve this question Transcribed image text
Answer #1

syntax for:

a) how to write a sub

sub subprocedureName()

end sub

b) a function

function functionName()

functionName=value 'to return value

End function

c) how to reference a given element in an array,

value = arrayName(indexNumber)

d) how to write the different types of loops (syntax) for next, do while, do until

1) for variable=initial value to final value

' statments

Next variable

2) Do While Condtion

'statements

Loop

3) Do Until Condtion

'Statements

Loop

e) format for a VBA If statement then

  

if(condtion) then

true statement

End if

f) format for a VBA If statement then else

if(condtion) then

true statement

else

false statement

End if

g) for generating a random value

Randomize

variable = Int(lowerbound+Rnd() * (upperbound - lowerbound + 1))

h) setting the range

dim variable as Range

Set variable = Range("ColumnNameInitial RowNumberInitial : ColumnNameFinal RowNumberFinal")

Add a comment
Know the answer?
Add Answer to:
(VBA Coding Simple Questions) Please write the syntax for: a) how to write a sub b)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Open up a clean Module and complete the coding of Module in VBA. Do the following tasks 1. Create a “main” sub, and assign the sub to the “Start” button on the worksheet. 2. Write the “clearOutput”...

    Open up a clean Module and complete the coding of Module in VBA. Do the following tasks 1. Create a “main” sub, and assign the sub to the “Start” button on the worksheet. 2. Write the “clearOutput” sub. Also, assign this sub to the “Reset” button. In this sub, you will clear the content of range (B3:D5), (B9:B11), and (D14:D15) on the worksheet “RP”. 3. Write the “loadData” sub. The data is stored in the worksheet “HR”. Name the data...

  • IN C-PROGRAMMING: What is Structured Programming; what is machine and assembly coding; what is pseudo coding?...

    IN C-PROGRAMMING: What is Structured Programming; what is machine and assembly coding; what is pseudo coding? What do the following do:   compiler, preprocessor, return 0, { }? Describe data types and what distinguishes each;  how would one combine data types? Explain functions and what are they for? Explain:  scanf (gets, fgets, getchar, fgetchar), printf( puts, fputs, putchar, fpetchar) What do the following mean:   strlen, strcmp, strcat, strcpy? What does fopen and fclose mean? Explain the difference between stdin and file. What if your file...

  • Write the code for a). to e) using VBA in excel

    write the code for a). to e) using VBA in excel : . a) Find the fifth customer whose first name starts vith ·K", and show his/her customer ID (using Do while ǐoop) ' b) Redo the above exercise with (Do Loop Until) c) Find how many Matthew are in the 1ist (using any loop you 1ike) and the same time find how many custoners are in the list ' Take care of your stop condition customerCounter - matthewCounter MsgBox...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • using C++ l Grant P. Microsoft PowerPoi.. Mail - elijah joshlin.. Tokyo Ghoul 3 (Sub.. How...

    using C++ l Grant P. Microsoft PowerPoi.. Mail - elijah joshlin.. Tokyo Ghoul 3 (Sub.. How to Watch The... OS EJ Purpose The purpose of this lab is to learn how to use pointers within an application. Process Use the following main function: include <stdio.h> void main int i; int j: int p i 10 5 20: Add printf statements to display the values assigned to each variable and their addresses. Your output should appear similar to the following: i:...

  • please do everything in matlab with commets next to each line of code thank you! %%...

    please do everything in matlab with commets next to each line of code thank you! %% Problem 1 - 1 point % Create a 100-element array, A, which is a random array of integers % Use the randi function for this, 'help randi' %% Problem 2 - 1 point % Use a 'for' loop and an 'if' statement to count how many odd numbers there are in the % array you made in #1 above %% Problem 3 - 1...

  • Write a java calculator program that perform the following operations: 1. function to Addition of two...

    Write a java calculator program that perform the following operations: 1. function to Addition of two numbers 2. function to Subtraction of two numbers 3. function to Multiplication of two numbers 4. function to Division of two numbers 5. function to Modulus (a % b) 6. function to Power (a b ) 7. function to Square root of () 8. function to Factorial of a number (n!) 9. function to Log(n) 10. function to Sin(x) 11. function to Absolute value...

  • Please design, write the code and create the requisite submission files in C++ for the following...

    Please design, write the code and create the requisite submission files in C++ for the following problem: A menu-driven program that offers the user 5 options as follows: Menu: 1. Display array 2. Add up all elements in the array and display that number. 3. Add 1 to each element in the array. 4. Swap the values in row one with the values in row three. 5. Exit In main(), declare and initialize a 2-dimensional array that contains 5 x...

  • Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called...

    Write a simple Java program with the following naming structure: Open Eclipse Create a workspace called hw1 Create a project called hw1 (make sure you select the “Use project folder as root for sources and class files”) Create a class called Hw1 in the hw1 package (make sure you check the box that auto creates the main method). Add a comment to the main that includes your name Write code that demonstrates the use of each of the following basic...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT