VBA Do While Loop

Tags:
Microsoft Excel
VBA
VBA Excel
Dim iJob As Integer 
Dim strJob As String
iJob = 5 
Do While ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value <> "" And iJob <> 4 
If ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value = strJob Then
 Select Case ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value 
 Case strJob ThisWorkbook.Sheets("Bulk Upload").Cells(I, 21).Value = strJob 
 If strJob = ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value Then ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Value = "0.51" 
 Else
ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Value = "N/A" End If If strJob <> ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value Then 
 If ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value = "" Then ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Interior.Color = RGB(255, 0, 0) 
 Else If 
ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value = "" Then ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Interior.Color = RGB(255, 0, 0) 
 End If
ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Value = ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value 
 If ThisWorkbook.Sheets("Defaults").Cells(iJob, 21).Value = "" Then ThisWorkbook.Sheets("Bulk Upload").Cells(I, 41).Interior.Color = RGB(255, 0, 0) iJob = 3 End Select
 iJob = iJob + 1 
 Loop
Any ideas why this will not work? I have moved the Loop numerous times but still not running


Software/Hardware used:
MS Excel VBA
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • ToddN2000
    Think about what is going on, Does it loop through any cycles? Does it hang in a constant loop?

    you initialize it   iJob = 5
    in you do loop condition   And iJob <> 4
    Your last IF test resets it  iJob = 3

    What are you looking to do here?
    131,380 pointsBadges:
    report
  • carlosdl
    Does it throw errors?  If so, what errors exactly?
    Does it run, but appears to hang?
    Does it run but produces unexpected results?

    More details are needed.
    84,630 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: