Saludos Profesor Sergio, de ante mano gracias por responder, realice lo que me sugirió coloque el código donde me indicó, sin embargo me sigue arrojando el mismo error.
' Restaurar formato de fuente
With wsHistorico.Rows("2:2").Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
' Incrementar automáticamente el número de recibo
wsRecibo.Range("J2").Value = wsRecibo.Range("J2").Value + 1
'Corrección de Error en impresión
Application.Wait (Now + TimeValue("0:00:01"))
' Imprimir
wsRecibo.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Por
dorgelis, · publicado
Muy Buenas amigos del foro:
Estoy intentando capturar datos mediante un formulario pero al gardar los datos me presenta un error, el codigo que he escrito es el siguiente:
Private Sub CommandButton6_Click()
Dim fecha As Date
Dim sucursal As String
Dim ingpart As Double
Dim factpart As Double
Dim inginst As Double
Dim factinst As Double
Dim exapart As String
Dim exapsv15 As String
Dim exapsv10 As String
Dim exaemp As String
Dim exaprom As String
Dim exacort As String
Dim exaoftalm As String
Dim valexapart As Double
Dim valexapsv15 As Double
Dim valexapsv10 As Double
Dim valexaemp As Double
Dim valexaprom As Double
Dim valexaoftalm As Double
Dim valtotexa As Double
fecha = Txtfecha
sucursal = Txtsucursal
ingpart = Txtingpart
factpart = Txtfactpart
inginst = Txtinginst
factinst = Txtfactinst
exapart = Txtexapart
exapsv15 = Txtexapsv15
exapsv10 = Txtexapsv10
exaemp = Txtexaemp
exaprom = Txtexaprom
exacort = Txtexacort
exaoftalm = Txtexaoftalm
valexapart = Txtvalexapart
valexapsv15 = Txtvalexapsv15
valexapsv10 = Txtvalexapsv10
valexaemp = Txtvalexaemp
valexaprom = Txtvalexaprom
valexaoftalm = Txtvalexaoftalm
valtotexa = Txtvaltotexa
Ultimafila = ActiveSheet.UsedRange.Rows - 1 + ActiveSheet.UsedRange.Rows.Count
Cells(ultmafila + 1, 1) = fecha
Cells(ultmafila + 1, 2) = sucursal
Cells(ultmafila + 1, 3) = ingpart
Cells(ultmafila + 1, 4) = factpart
Cells(ultmafila + 1, 5) = inginst
Cells(ultmafila + 1, 6) = factinst
Cells(ultmafila + 1, 7) = exapart
Cells(ultmafila + 1, 8) = exapsv15
Cells(ultmafila + 1, 9) = exapsv10
Cells(ultmafila + 1, 10) = exaemp
Cells(ultmafila + 1, 11) = exacort
Cells(ultmafila + 1, 12) = exaprom
Cells(ultmafila + 1, 13) = exaoftalm
Cells(ultmafila + 1, 14) = valexapart
Cells(ultmafila + 1, 15) = valexapsv15
Cells(ultmafila + 1, 16) = valexapsv10
Cells(ultmafila + 1, 17) = valexaemp
Cells(ultmafila + 1, 18) = valexaprom
Cells(ultmafila + 1, 19) = valexaoftalm
Cells(ultmafila + 1, 20) = valtotexa
Txtfecha.SetFocus
End Sub
al guardarlo me presenta el siguiente error: se ha producido el error "13" en tiempo de ejecución, no coinciden los tipos.
al darle depurar se me ubica en la siguiente linea:
valexaoftalm = Txtvalexaoftalm
valtotexa = Txtvaltotexa
Ultimafila = ActiveSheet.UsedRange.Rows - 1 + ActiveSheet.UsedRange.Rows.Count ESTA ES LA FILA DEL ERROR
Cells(ultmafila + 1, 1) = fecha
Cells(ultmafila + 1, 2) = sucursal
Cells(ultmafila + 1, 3) = ingpart
Cells(ultmafila + 1, 4) = factpart
Cells(ultmafila + 1, 5) = inginst
Cells(ultmafila + 1, 6) = factinst
Cells(ultmafila + 1, 7) = exapart
Cells(ultmafila + 1, 8) = exapsv15
Cells(ultmafila + 1, 9) = exapsv10
Cells(ultmafila + 1, 10) = exaemp
Mi problema es que no encuentro la incongruencia del codigo, me pueden ayudar a resolver esta situación, y de antemano les agradesco por su ayuda.