- 06 Fev 2020 às 17:58
#52190
Mais uma vez peço ajuda.
Estou com uma rotina While, e dentro dela quero colocar uma ou mais condições com if e desviar (loop) naquele ponto.
With Plan1
Do While .Cells(Linha, 1).Value <> ""
Data = .Cells(Linha, 1).Value
DataPag = .Cells(Linha, 6).Value
If ckPagos.Value = True And DataPag = "" Then
' minha dúvida aqui
' quero dar um loop aqui
End If
If CkPend.Value = True And DataPag <> "" Then
' minha dúvida aqui
' quero dar um loop aqui
End If
If Data >= DataIni And Data <= DataFim Then
With ListBox1
.AddItem
.List(LinhaListBox, 0) = Plan1.Cells(Linha, 1)
.List(LinhaListBox, 1) = Plan1.Cells(Linha, 2)
.List(LinhaListBox, 2) = Plan1.Cells(Linha, 3)
.List(LinhaListBox, 3) = Plan1.Cells(Linha, 4)
cValor = CStr(Format(Plan1.Cells(Linha, 5), "###,##0.00"))
.List(LinhaListBox, 4) = Space(10 - Len(cValor)) & cValor
.List(LinhaListBox, 5) = Plan1.Cells(Linha, 6)
If DataPag = "" Then
nTotPend = nTotPend + Plan1.Cells(Linha, 5)
Else
nTotPago = nTotPago + Plan1.Cells(Linha, 5)
End If
End With
LinhaListBox = LinhaListBox + 1
End If
Linha = Linha + 1
Wend
End With
Minha origem é CLIPPER e estou sofrendo com as mudanças.
Agradeço ..
Estou com uma rotina While, e dentro dela quero colocar uma ou mais condições com if e desviar (loop) naquele ponto.
With Plan1
Do While .Cells(Linha, 1).Value <> ""
Data = .Cells(Linha, 1).Value
DataPag = .Cells(Linha, 6).Value
If ckPagos.Value = True And DataPag = "" Then
' minha dúvida aqui
' quero dar um loop aqui
End If
If CkPend.Value = True And DataPag <> "" Then
' minha dúvida aqui
' quero dar um loop aqui
End If
If Data >= DataIni And Data <= DataFim Then
With ListBox1
.AddItem
.List(LinhaListBox, 0) = Plan1.Cells(Linha, 1)
.List(LinhaListBox, 1) = Plan1.Cells(Linha, 2)
.List(LinhaListBox, 2) = Plan1.Cells(Linha, 3)
.List(LinhaListBox, 3) = Plan1.Cells(Linha, 4)
cValor = CStr(Format(Plan1.Cells(Linha, 5), "###,##0.00"))
.List(LinhaListBox, 4) = Space(10 - Len(cValor)) & cValor
.List(LinhaListBox, 5) = Plan1.Cells(Linha, 6)
If DataPag = "" Then
nTotPend = nTotPend + Plan1.Cells(Linha, 5)
Else
nTotPago = nTotPago + Plan1.Cells(Linha, 5)
End If
End With
LinhaListBox = LinhaListBox + 1
End If
Linha = Linha + 1
Wend
End With
Minha origem é CLIPPER e estou sofrendo com as mudanças.
Agradeço ..