what happens when this code is run?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Suppose that an Excel spreadsheet contains the value "Hello" in cell A10 but
is otherwise empty when the following code fragment is executed:

Code:
Dim intCounter As Integer

intCounter = 1

Do While Cells(intCounter, 1).Value <> "Hello"
intCounter = intCounter + 1
Loop
After this code fragment is run, the value of intCounter will be what?
 
is homework not allowed?

Don Guillett said:
Homework?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
xtalenaj said:
Suppose that an Excel spreadsheet contains the value "Hello" in cell A10
but
is otherwise empty when the following code fragment is executed:

Code:
Dim intCounter As Integer

intCounter = 1

Do While Cells(intCounter, 1).Value <> "Hello"
intCounter = intCounter + 1
Loop
After this code fragment is run, the value of intCounter will be what?
 
Sometimes it's just simpler to test it.
Suppose that an Excel spreadsheet contains the value "Hello" in cell A10 but
is otherwise empty when the following code fragment is executed:

Code:
Dim intCounter As Integer

intCounter = 1

Do While Cells(intCounter, 1).Value <> "Hello"
intCounter = intCounter + 1
Loop
After this code fragment is run, the value of intCounter will be what?
 
It is not that homework is not allowed, it just does not help you to learn
very much if someone just gives you the answer. BTW the answer to this one
is that intCounter will equal the number of iterations that the loop makes
before reaching a cell in column A that contains the string "Hello". Were
you expecting a number?

xtalenaj said:
is homework not allowed?

Don Guillett said:
Homework?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
xtalenaj said:
Suppose that an Excel spreadsheet contains the value "Hello" in cell A10
but
is otherwise empty when the following code fragment is executed:

Code:
Dim intCounter As Integer

intCounter = 1

Do While Cells(intCounter, 1).Value <> "Hello"
intCounter = intCounter + 1
Loop
After this code fragment is run, the value of intCounter will be what?
 
In the time it took for you to log on, write the question, which
includes the code!! you could have pasted the code in excel to get the
answer.. LOL
 
Back
Top