Saltar al contenido

Llenar reporte con Macro me da error


Recommended Posts

publicado

Buenas tardes, me he encontrado con este error (foto) y no he podido dar con cual puede ser la raíz del problema.

El archivo adjunto tiene una macro, su función es no escribir todo el reporte (todos los campos) solamente con llenar los campos azules y darle al botón Llenar Reporte,  llena los demás datos automáticamente, los links de referencia hacia donde extrae la información están correctos los verifique bien, y si me extrae los datos cuando le doy en No. UT y después le doy al botón Llamar y me consulta bien.

No se que pudiera ser, si alguien por ahí le da un review a la macro, como quiera yo estoy modificando, si encuentro el detalle lo comentare, a ver si por ahí le ven que pudiera ser, si se puede claro, 

mil gracias.

Prupuesta.xlsm

Error.png

publicado

¡Hola a todos!

Hay que tener cuidado cuando se agregan nuevas condiciones.  El error específico está en en los Equipos SONATEST y KRAUTKRAMER.  Verifica los comentarios y analiza el error.  Habían 19 IF's y solo 18 End IF's.

If Hoja1.Cells(10, 3) = "" Or Hoja1.Cells(10, 22) = "" Then '19
    If Hoja1.Cells(9, 2) <> "" Then 'TAREA 18
        If Hoja1.Cells(9, 15) <> "" Then 'UNIDAD 17
            If Hoja1.Cells(13, 9) <> "" Then 'ESPECIFICACION 16
                If Hoja1.Cells(18, 13) <> "" Then ''EQUIPO KRAUTKRAMER 15
                 If Hoja1.Cells(18, 21) <> "" Then 'EQUIPO SONATEST 14
                    If Hoja1.Cells(20, 16) <> "" Or Hoja1.Cells(20, 20) <> "" Then 'SIMULACION 13
                        If Hoja1.Cells(23, 5) <> "" Then 'FRECUENCIA 12
                            If Hoja1.Cells(23, 22) <> "" Then 'GANANCIA 11
                                If Hoja1.Cells(24, 3) <> "" Or Hoja1.Cells(24, 10) <> "" Then 'HAZ 10
                                    If Hoja1.Cells(29, 2) <> "" Then 'ESPESOR 9
                                         If Hoja1.Cells(34, 10) <> "" Or Hoja1.Cells(34, 14) <> "" Then 'EXTENSION 8
                                            If Hoja1.Cells(36, 13) <> "" Or Hoja1.Cells(36, 20) <> "" Then 'INACCESIBILIDAD 7
                                                If Hoja1.Cells(41, 13) <> "" Or Hoja1.Cells(41, 21) <> "" Then 'REGISTRO 6
                                                        cargar
                                                        If Hoja1.Cells(10, 22) = "" Then ' 5
                                                            MsgBox ("Verifica que la tarea sea correcta")
                                                            MsgBox ("Verifica la unidad (A/B/C o si es unica solo 1)")
															Else
																If Hoja1.Cells(13, 9) = "AWS D1.1 CARGA CICLICA" Then ' 4
																	llenado
																	Hoja1.Cells(12, 23) = "ANEXO H  AWS-D1.1"
																	Hoja1.Cells(14, 11) = "AWS-D1,1 SECC.6 TABLA 6.3"
																	Hoja1.Cells(15, 1) = ""
																	Hoja1.Cells(16, 1) = ""
																	Else
																		If Hoja1.Cells(13, 9) = "AWS D1.1 CARGA ESTATICA" Then ' 3
																			llenado
																			Hoja1.Cells(12, 23) = "ANEXO H  AWS-D1.1"
																			Hoja1.Cells(14, 11) = "AWS-D1,1 SECC.6 TABLA 6.2"
																			Hoja1.Cells(15, 1) = ""
																			Hoja1.Cells(16, 1) = ""
																		Else
																			If Hoja1.Cells(13, 9) = "ASME SECCION VIII DIV. I" Then ' 2
																				Hoja1.Cells(12, 23) = " ASME SECCION V"
																				Hoja1.Cells(14, 11) = "TODA INDICACION QUE SOBREPASE EL NIVEL DE REFERENCIA Y TENGA UNA"
																				Hoja1.Cells(15, 1) = "LONGITUD MAYOR A 1/4 SERA RECHAZADA Y REPARADA, TODA AQUELLA INDICACION QUE  ESTE AL 20 % DEL NIVEL DE REFERENCIA"
																				Hoja1.Cells(16, 1) = "DEBERA SER INVESTIGADA Y EVALUADA."
																				llenado
																				tabla
																			 Else
																				If Hoja1.Cells(13, 9) = "SA-578, ASME SECCION II" Then ' 1
																				  llenado
																				  Hoja1.Cells(12, 23) = "ASME SECCION V"
																				  Hoja1.Cells(14, 11) = "NIVEL A; LAS INDICACIONES RECHAZABLES SERAN AQUELLAS DONDE EL AREA DE UNA O MAS DISCONTINUIDADES PRODUCEN UNA CONTINUUA,"
																				  Hoja1.Cells(15, 1) = "DONDE SE TENGA UNA TOTAL PERDIDA DE REFLEXION ACOMPAÑADA POR INDICACIONES CONTINUAS EN UN MISMO PLANO QUE NO PUEDEN SER"
																				  Hoja1.Cells(16, 1) = "COMPRENDIDAS EN UN CIRCULO CON DIAMETRO DE 3IN O 1/2 ESPESOR DE LA PLACA."
																				End If ' Cierra 1
																			 End If ' Cierra 2
																		End If ' Cierra 3
																End If ' Cierra 4
                                                        
                                                        End If ' Cierra 5
                                                Else
                                                MsgBox ("Indica si se cuenta con registro de indicaciones con una X")
                                                End If ' Cierra 6
                                            Else
                                            MsgBox ("Indica areas inaccesibles si aplica con una X")
                                            End If ' Cierra 7
                                        Else
                                        MsgBox ("Indica la extension del examen con una X")
                                        End If ' Cierra 8
                                    Else
                                    MsgBox ("Indica el espesor en la tabla de calibracion")
                                    End If ' Cierra 9
                                Else
                                MsgBox ("Indica el tipo de haz con una X")
                                End If ' Cierra 10
                                Else
                            MsgBox ("Indica la ganancia")
                            End If ' Cierra 11
                        Else
                        MsgBox ("Indica la frecuencia")
                        End If ' Cierra 12
                    Else
                    MsgBox ("Indica el tipo de simulacion con una X (Bloque / Electronico")
                    End If ' Cierra 13
                Else
                MsgBox ("Indica el equipo de prueba SONATEST con una X")
                End If ' Cierra 14
			  Else
                MsgBox ("Indica el equipo de prueba KRAUTKRAMER con una X")
               End If ' Cierra 15
            Else
            MsgBox ("Indica la especificacion de referencia")
            End If ' Cierra 16
        Else
        MsgBox ("Indica el numero de unidad")
        End If ' Cierra 17
    Else
    MsgBox ("Indica el numero de tarea")
    End If ' Cierra 18
Else
MsgBox ("Antes de llamar un nuevo reporte da click en borrar")
End If ' Cierra 19

¡Bendiciones!

publicado

Gracias por sus respuestas, efectivamente ahora no sale el error, pero me sale el aviso de la ventana que falta llenar una celda, sin embargo la celda que indica el aviso, tiene información, a ver si ni me vuelvo loca, ya le he movido y no logro pasar de este paso.

 

saludos.

publicado

Yo lo veo mas claro así:

 

If Cells(10, 3) = "" Or Cells(10, 22) = "" Then '19
If Cells(9, 2) <> "" Then 'TAREA 18
If Cells(9, 15) <> "" Then 'UNIDAD 17
If Cells(13, 9) <> "" Then 'ESPECIFICACION 16
If Cells(18, 13) <> "" Then ''EQUIPO KRAUTKRAMER 15
If Cells(18, 21) <> "" Then 'EQUIPO SONATEST 14
If Cells(20, 16) <> "" Or Cells(20, 20) <> "" Then 'SIMULACION 13
If Cells(23, 5) <> "" Then 'FRECUENCIA 12
If Cells(23, 22) <> "" Then 'GANANCIA 11
If Cells(24, 3) <> "" Or Cells(24, 10) <> "" Then 'HAZ 10
If Cells(29, 2) <> "" Then 'ESPESOR 9
If Cells(34, 10) <> "" Or Cells(34, 14) <> "" Then 'EXTENSION 8
If Cells(36, 13) <> "" Or Cells(36, 20) <> "" Then 'INACCESIBILIDAD 7
If Cells(41, 13) <> "" Or Cells(41, 21) <> "" Then 'REGISTRO 6
   cargar
   '---------------------------------------------------------------------------
   If Cells(10, 22) = "" Then ' 5
      MsgBox ("Verifica que la tarea sea correcta")
      MsgBox ("Verifica la unidad (A/B/C o si es unica solo 1)")
      Else
      Select Case Cells(13, 9)
         Case "AWS D1.1 CARGA CICLICA"   ' 4
            llenado
            Cells(12, 23) = "ANEXO H  AWS-D1.1"
            Cells(14, 11) = "AWS-D1,1 SECC.6 TABLA 6.3"
            Cells(15, 1) = ""
            Cells(16, 1) = ""
         Case "AWS D1.1 CARGA ESTATICA"  ' 3
            llenado
            Cells(12, 23) = "ANEXO H  AWS-D1.1"
            Cells(14, 11) = "AWS-D1,1 SECC.6 TABLA 6.2"
            Cells(15, 1) = ""
            Cells(16, 1) = ""
         Case "ASME SECCION VIII DIV. I"  ' 2
            Cells(12, 23) = " ASME SECCION V"
            Cells(14, 11) = "TODA INDICACION QUE SOBREPASE EL NIVEL DE REFERENCIA Y TENGA UNA"
            Cells(15, 1) = "LONGITUD MAYOR A 1/4 SERA RECHAZADA Y REPARADA, TODA AQUELLA INDICACION QUE  ESTE AL 20 % DEL NIVEL DE REFERENCIA"
            Cells(16, 1) = "DEBERA SER INVESTIGADA Y EVALUADA."
            llenado
            tabla
         Case "SA-578, ASME SECCION II" '  1
            llenado
            Cells(12, 23) = "ASME SECCION V"
            Cells(14, 11) = "NIVEL A; LAS INDICACIONES RECHAZABLES SERAN AQUELLAS DONDE EL AREA DE UNA O MAS DISCONTINUIDADES PRODUCEN UNA CONTINUUA,"
            Cells(15, 1) = "DONDE SE TENGA UNA TOTAL PERDIDA DE REFLEXION ACOMPAÑADA POR INDICACIONES CONTINUAS EN UN MISMO PLANO QUE NO PUEDEN SER"
            Cells(16, 1) = "COMPRENDIDAS EN UN CIRCULO CON DIAMETRO DE 3IN O 1/2 ESPESOR DE LA PLACA."
      End Select
   End If
   '----------------------------------------------------------------------------
Else: MsgBox ("Indica si se cuenta con registro de indicaciones con una X"):   End If ' Cierra 6
Else: MsgBox ("Indica areas inaccesibles si aplica con una X"):                End If ' Cierra 7
Else: MsgBox ("Indica la extension del examen con una X"):                     End If ' Cierra 8
Else: MsgBox ("Indica el espesor en la tabla de calibracion"):                 End If ' Cierra 9
Else: MsgBox ("Indica el tipo de haz con una X"):                              End If ' Cierra 10
Else: MsgBox ("Indica la ganancia"):                                           End If ' Cierra 11
Else: MsgBox ("Indica la frecuencia"):                                         End If ' Cierra 12
Else: MsgBox ("Indica el tipo de simulacion con una X (Bloque / Electronico"): End If ' Cierra 13
Else: MsgBox ("Indica el equipo de prueba SONATEST con una X"):                End If ' Cierra 14
Else: MsgBox ("Indica el equipo de prueba KRAUTKRAMER con una X"):             End If ' Cierra 15
Else: MsgBox ("Indica la especificacion de referencia"):                       End If ' Cierra 16
Else: MsgBox ("Indica el numero de unidad"):                                   End If ' Cierra 17
Else: MsgBox ("Indica el numero de tarea"):                                    End If ' Cierra 18
Else: MsgBox ("Antes de llamar un nuevo reporte da click en borrar"):          End If ' Cierra 19

 

publicado

Buenas tardes, quiero agradecer al Dr Hyde y a johnmpl por su ayuda mil gracias, y como siempre es un placer el apoyo del Maestro @Macro Antonio, como la de todos los que me han ayudado; aplique la macro tal y como la copie del Foro y me funciono a la perfección, muchas gracias a los tres nuevamente por  apartar tiempo para solucionar mi inquietud y la de muchos. Tema Solucionado.

Thanks ^_^

  • Silvia bloqueó este tema

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

×
×
  • Crear nuevo...

Información importante

Echa un vistazo a nuestra política de cookies para ayudarte a tener una mejor experiencia de navegación. Puedes ajustar aquí la configuración. Pulsa el botón Aceptar, si estás de acuerdo.