I'm struggling with my do loop

  • Thread starter Thread starter Alla
  • Start date Start date
A

Alla

Somehow my do loop is not working. More specifically, it does not
recognize the "Range("D9:Q9").Cells(1, j).Value = LoanAmt(j)"
statement below. It gives the application-defined or object-defined
error message (my favourite message! it's the hardest to figure out)
:(

However, when I tried substituting j for let's say 2 making it
"Range("D9:Q9").Cells(1, 2).Value = LoanAmt(j) it worked.
also, when I substituted my do loop with for loop, it also worked. Is
there a different syntax that I'm supposed to use with do loops?

Any help, suggestions will be appreciated! :)



' j has to be 1 through 14
j = InputBox("Enter type of financing:" _
& j, "Financing j", vbYesNo)

Do Until j = "" Or j = vbNo
LoanAmt(j) = InputBox("Enter an amount of financing for type:" _
& j, "Financing $ for j", vbYesNo)

' we do not want to assign a value to LoanAmt(14)
'MsgBox j
Do While j < 14
Range("D9:Q9").Cells(1, j).Value = LoanAmt(j)
Loop
LoanAmt(14) = Range("q9")
 
Just before 'Do Until j = "" Or j=vbNo'
try with add following line:
j = Int(j)

Sharad
 
Sorry , it should be
just AFTER 'Don Until ...............'

Sharad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top