Next sin For, como error de compilación
Publicado por Jose (1 intervención) el 05/02/2024 18:34:18
For Indice = 1 To 15
Set Empleado = Hoja2.Cells(Indice + 7, 2)
If Empleado.Value = "" Then
Set Autoforma = Hoja2.Shapes("_Fila" & Indice)
Autoforma , Visible = msoFalse
Set Autoforma = Hoja2.Shapes("_cFila" & Indice)
Autoforma , Visible = msoFalse
Else
empFechaInicio = Empleado.Offset(0, 1).Value
empFechaFin = Empleado.Offset(0, 2).Value
If Month(empFechaInicio) < Month(pcFechaInicio) Then
DiaMin = Day(pcFechaInicio)
Else
DiaMin = Day(empFechaInicio)
If Month(empFechaInicio) > Month(pcFerchaInicio) Then
DiaMax = Day(pcFechaFin)
Else
DiaMax = Day(empFechaFin)
End If
Set Autoforma = Hoja2.Shapes("_Fila" & Indice)
With Autoforma
.Left = Hoja2.Cells(Indice + 7, DiaMin + 6 - 1).Left
.With = Hoja2.Range(Cells(Indice + 7, DiaMin + 6 - 1), Cells(Indice + 7, DiaMax + 6 - 1)).Width
Set EmpEncontrado = ColEmps.Find(What:=Empleado.Value)
Set Departamento = EmpEncontrado.Offset(0, 1)
Set DepEncontrado = ColDeps.Find(What:=Departamento.Value)
.Fill.ForeColor.RGB = DepEncontrado.Interior.Color
.TextFrame.Characters.Text = Empleado.Value
.TextFrame.HorizontalAlignment = xlHALingLeft
.TextFrame.VerticallAlignment = xlValingCenter
.TextFrame.MarginLeft = 15
.TextFrame.Characters.Font.Color = RGB(0, 0, 0)
.Visible = msoTrue
End With
Set Autoforma = Hoja2.Shapes("_cFila" & Indice)
With Autoforma
.Left = Hoja2.Cells(Indice + 7, DiaMin + 6 - 1).Left
NombreImagen = Mid(Empleado.Value, 1, InStr(1, Empleado.Value, " ") - 1) & ",jpg"
RutaImagen = ActiveWorkbook.Path & Applications.PathSeparator & "Fotos" & Applications.PathSeparator & NombreImagen
.Fill.UserPicture RutaImagen
.Visible = msoTrue
End With
End If
Next Indice ( Me marca error de compilación Next sin For y no me permite correr la macro)
End Sub
Set Empleado = Hoja2.Cells(Indice + 7, 2)
If Empleado.Value = "" Then
Set Autoforma = Hoja2.Shapes("_Fila" & Indice)
Autoforma , Visible = msoFalse
Set Autoforma = Hoja2.Shapes("_cFila" & Indice)
Autoforma , Visible = msoFalse
Else
empFechaInicio = Empleado.Offset(0, 1).Value
empFechaFin = Empleado.Offset(0, 2).Value
If Month(empFechaInicio) < Month(pcFechaInicio) Then
DiaMin = Day(pcFechaInicio)
Else
DiaMin = Day(empFechaInicio)
If Month(empFechaInicio) > Month(pcFerchaInicio) Then
DiaMax = Day(pcFechaFin)
Else
DiaMax = Day(empFechaFin)
End If
Set Autoforma = Hoja2.Shapes("_Fila" & Indice)
With Autoforma
.Left = Hoja2.Cells(Indice + 7, DiaMin + 6 - 1).Left
.With = Hoja2.Range(Cells(Indice + 7, DiaMin + 6 - 1), Cells(Indice + 7, DiaMax + 6 - 1)).Width
Set EmpEncontrado = ColEmps.Find(What:=Empleado.Value)
Set Departamento = EmpEncontrado.Offset(0, 1)
Set DepEncontrado = ColDeps.Find(What:=Departamento.Value)
.Fill.ForeColor.RGB = DepEncontrado.Interior.Color
.TextFrame.Characters.Text = Empleado.Value
.TextFrame.HorizontalAlignment = xlHALingLeft
.TextFrame.VerticallAlignment = xlValingCenter
.TextFrame.MarginLeft = 15
.TextFrame.Characters.Font.Color = RGB(0, 0, 0)
.Visible = msoTrue
End With
Set Autoforma = Hoja2.Shapes("_cFila" & Indice)
With Autoforma
.Left = Hoja2.Cells(Indice + 7, DiaMin + 6 - 1).Left
NombreImagen = Mid(Empleado.Value, 1, InStr(1, Empleado.Value, " ") - 1) & ",jpg"
RutaImagen = ActiveWorkbook.Path & Applications.PathSeparator & "Fotos" & Applications.PathSeparator & NombreImagen
.Fill.UserPicture RutaImagen
.Visible = msoTrue
End With
End If
Next Indice ( Me marca error de compilación Next sin For y no me permite correr la macro)
End Sub
Valora esta pregunta
0