0
Мы застреваем в цикле и не можем заставить его продолжать тянуть значения. Этот код просто вытащит первое значение и продолжит цикл.Почему этот код продолжает циклироваться?
Sub createpbp()
Dim iRows As Integer
Dim i As Integer 'webtext row counter
Dim iR As Integer
Dim iPr As Integer 'row counter for pbp worksheet
Dim wksWT As Worksheet
iPr = 1
Set wksWT = Worksheets("Webtext") 'creating a variable for the text pulled from website
wksWT.Activate 'activate the webtext sheet
iRows = wksWT.UsedRange.rows.Count 'counts rows in the play by play
For i = 1 To iRows 'row 1 to end of rows
If Cells(i, 1) = "Play By Play Innings" Then 'if the cell value says play by play innings
Do Until Cells(i, 1) = "Runs" 'continue doing the following until reach end of inning
Cells(i, 1).Copy 'copy the value of the first event in inning
Sheets("Play by Play text").Select 'open up new worksheet
If Cells(iPr, 1) = Null Then
Cells(iPr, 1).Paste
Else
iPr = iPr + 1
End If
Loop
End If
Next i
Посмотрите на Do not Cell Cell (i, 1) = «Runs» ... if Cells (i, 1) <> «Runs», этот цикл будет работать вечно, поскольку ничего в этом цикле не изменяет i – oortCloud