Question

In: Computer Science

Review the following code: Sub RunLoop() For n = 1 to 100 ActiveSheet.Range("A" & n).Value =...

Review the following code:
Sub RunLoop()
For n = 1 to 100
ActiveSheet.Range("A" & n).Value = n
End Sub

Solutions

Expert Solution

This is an MS Excel VBA code.

It prints values from 1 to 100 in the row A of an active tab in an excel worksheet.

Incorrect code

Sub RunLoop()
For n = 1 to 100
ActiveSheet.Range("A" & n).Value = n
End Sub

Correct code

Sub RunLoop()
For n = 1 to 100
ActiveSheet.Range("A" & n).Value = n
Next n
End Sub

Statement in red (Next n) was missing.

Snapshot of the code

Snapshot of the output

This will go up until 100.

Let me know if this is clear.


Related Solutions

What is the value of n after this code runs? 1 Point int n = 0;...
What is the value of n after this code runs? 1 Point int n = 0; int j = 7; if ((j!=0) && (n < 25)) { n = 1; if (j > 4) { n = 2; } else { n = 3; } } else { n = 4; if (j%2 >= 2) { n = 5; } else { n = 6; } }
1. During 2012, Parent sold inventory originally costing 60,000 to its 100% Sub for 75,000. Sub...
1. During 2012, Parent sold inventory originally costing 60,000 to its 100% Sub for 75,000. Sub sold all but 10,000 of the inventory purchased from Parent for 70,000 to external entities. What is the unrealized gross profit? 2.During 2012, Parent sold inventory originally costing 60,000 to its 100% Sub for 75,000. Sub sold all but 10,000 of the inventory purchased from Parent for 70,000 to external entities. What is the gross profit percent? 3.During 2012, Parent sold inventory originally costing...
Write a code using c# Maximum Sub Array.
Write a code using c# Maximum Sub Array.
1.       Assume the following recursive formula: R(n)=R(n-1)*n*n where R(0)=1 The code might look like this: public double...
1.       Assume the following recursive formula: R(n)=R(n-1)*n*n where R(0)=1 The code might look like this: public double R(n) {               If n==0 return 1               else return R(n-1); } a.       What is the recurrence relation showing the number of multiplications for the recursive function R(n) and program? b.       Solve the recurrence relation. 2.       Show the following is true for all integers n > 1 using mathematical induction:    3.       Sort the following list into alphabetical order using selection sort. Write the list showing the swapped...
On January 1, Year 1, Josh Corp. sold equipment to Mayfair Inc. (its 100% sub) for...
On January 1, Year 1, Josh Corp. sold equipment to Mayfair Inc. (its 100% sub) for $120,000 in cash. The equipment originally cost $160,000 but had a book value of $96,000 when transferred. On that date, the equipment had a five-year remaining life 1.       Prepare the consolidation entries relating to the equipment sale for 12/31, Year 1. 2.      Prepare the consolidation entries relating to the equipment sale for 12/31, Year 2.
Find the value of ∑(−1)^n/(3n+1) from n=0 to ∞
Find the value of ∑(−1)^n/(3n+1) from n=0 to ∞
Review the following resources by clicking on these links: AICPA Code of Professional Conduct - This...
Review the following resources by clicking on these links: AICPA Code of Professional Conduct - This website provides auditors with the principles and rules for conducting professional services Journal of Accountancy - This site provides a current article on Corporate Ethics and Compliance Programs Independence Guide - The Code of Professional Conduct focuses special attention to auditor independence. This provides a guide on independence. A Framework for Auditor Independence - The Journal of Accountancy's article on Auditor Independence Code of...
1. What will be the value of numbers[1] after the following code is executed? int[] numbers...
1. What will be the value of numbers[1] after the following code is executed? int[] numbers = {22, 33, 44}; for(int k = 0; k < 3; k++) { numbers[k] = numbers[k] + 5; } } 2. What will be the results of the following code? final int ARRAY_SIZE = 5; double[] x = new double[ARRAY_SIZE]; for(int i = 1; i <= ARRAY_SIZE; i++) { x[i] = 10.0; } 3.What is the value of numbers [3] after the following line...
1. Votoan has the following capital components and costs. Component                 Value             &n
1. Votoan has the following capital components and costs. Component                 Value               After-tax Cost Debt                            15,500             11% Preferred Stock           7,500               14% Common Equity         10,000             16% What is Votoan’s weighted average cost of capital? A. 11.67% B.12.41% C.13.19% D.14.55% 2. Poss Inc. (PI) common stock has a beta of 1.3. If the expected return on the average stock is 16 percent and the risk-free rate is 6 percent, what is the required rate of return for PI? A.12.2% B.16.4% C.19.0% D.13.2%
Consider the following for a portfolio: Year Beginning value Dividend Ending value 1 $100 $1.46 $110...
Consider the following for a portfolio: Year Beginning value Dividend Ending value 1 $100 $1.46 $110 2 $110 $1.12 $112 3 $112 $1.27 $115 What is the geometric mean annual return?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT