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

n following code if variable n=0, a=5 and b=10 then what will be the value of...
n following code if variable n=0, a=5 and b=10 then what will be the value of variable ‘n’ after while loop executed. Show your working as well. while(n<=(a^b)) { n++; } printf("%d",n)
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...
Use the following code fragment: 1       sub x4,x4,x0      2       add x3,x4,x0      3       sub x6,x3,x2...
Use the following code fragment: 1       sub x4,x4,x0      2       add x3,x4,x0      3       sub x6,x3,x2      4       mul x1,x6,x7      5       add x2,x5,x9      6       div x5,x9,x2      7       add x8,x1,x4 Draw the dependency graph among the instructions and indicate the type of data hazards (such as RAW, WAW, etc.) on each edge.
Consider the following pseudo-code: /* Global memory area accessible by threads */ #define N 100 struct...
Consider the following pseudo-code: /* Global memory area accessible by threads */ #define N 100 struct frame *emptyStack[N]; struct frame *displayQueue[N]; int main() { /* ** Initialise by allocating the memory for N frames ** And place the N frame addresses into the ** empty Stack array */ Initialise(); thread_t tid1, tid2; threadCreate(&tid1, GetFrame); threadCreate(&tid2, ShowFrame); sleep(300); } GetFrame() { struct frame *frame; struct frame local; while (1) { CameraGrab(&local); /* get a frame from the camera store it in...
1) At the end of the following algorithm segment, what value is in variable n? n:=...
1) At the end of the following algorithm segment, what value is in variable n? n:= 31 WHILE ( n is prime) n:= n -2 END WHILE 2) Prove that there is no greatest negative real number using contradiction or contraposition.
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 ∞
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT