AYUDA!
Publicado por Diego (31 intervenciones) el 29/06/2007 02:25:57
Buenas tarde tengo un pequeño problema con una rutina de una macro. Ahorita me estaba funcionando bien y de repente una de las partes ya no funciona y me dice que no coinciden los tipos, pero las otras partes son iguales y esas si funcionan, no entiendo. Pongo el código para ver si me pueden ayudar.
Sub Ajuste()
Set RSIII = ActiveSheet.range("SIII")
Set RSVI = ActiveSheet.range("SVI")
Set RSVIII = ActiveSheet.range("SVIII")
Set RTOTAL = ActiveSheet.range("TOTAL")
Set RFILA = ActiveSheet.range("FILAS")
Dim opSIII As Integer
Dim opSVI As Integer
Dim opSVIII As Integer
Dim opTOTAL As Integer
Dim iSIII As Integer
Dim iSVI As Integer
Dim iSVIII As Integer
Dim iTOTAL As Integer
Dim iFILA As Integer
Dim iCOLUMNA As Integer
opSIII = 0
opSVI = 0
opSVIII = 0
opTOTAL = 0
iSIII = 1
iSVI = 1
iSVIII = 1
iTOTAL = 1
iFILA = 1
iCOLUMNA = 1
For Each k In RSIII
While RSIII.Cells(iSIII, 1).Value <> ""
opSIII = (RSIII.Cells(iSIII, 1).Value * 2) - 30 <--------- aquí es donde me dice "no coinciden tipos"
RSIII.Cells(iSIII, 1).Value = opSIII
iSIII = iSIII + 1
Wend
Next
For Each n In RSVI
While RSVI.Cells(iSVI, 1).Value <> ""
opSVI = (RSVI.Cells(iSVI, 1).Value * 2) - 20 <-------- esta y la de abajo funcionan bien
RSVI.Cells(iSVI, 1).Value = opSVI
iSVI = iSVI + 1
Wend
Next
For Each p In RSVIII
While RSVIII.Cells(iSVIII, 1).Value <> ""
opSVIII = (RSVIII.Cells(iSVIII, 1).Value * 2) - 17
RSVIII.Cells(iSVIII, 1).Value = opSVIII
iSVIII = iSVIII + 1
Wend
Next
For Each s In RTOTAL
While RTOTAL.Cells(iTOTAL, 1).Value <> ""
For Each celda In RFILA
opTOTAL = opTOTAL + RFILA.Cells(RFILA, iCOLUMNA).Value
iCOLUMNA = iCOLUMNA + 1
' iFILA2 = iFILA2 + 1
' iCOLUMNA2 = iCOLUMNA2 + 1
Next
RTOTAL.Cells(iTOTAL, 1).Value = opTOTAL
iTOTAL = iTOTAL + 1
iFILA = iFILA + 1
Wend
Next
End Sub
Sub Ajuste()
Set RSIII = ActiveSheet.range("SIII")
Set RSVI = ActiveSheet.range("SVI")
Set RSVIII = ActiveSheet.range("SVIII")
Set RTOTAL = ActiveSheet.range("TOTAL")
Set RFILA = ActiveSheet.range("FILAS")
Dim opSIII As Integer
Dim opSVI As Integer
Dim opSVIII As Integer
Dim opTOTAL As Integer
Dim iSIII As Integer
Dim iSVI As Integer
Dim iSVIII As Integer
Dim iTOTAL As Integer
Dim iFILA As Integer
Dim iCOLUMNA As Integer
opSIII = 0
opSVI = 0
opSVIII = 0
opTOTAL = 0
iSIII = 1
iSVI = 1
iSVIII = 1
iTOTAL = 1
iFILA = 1
iCOLUMNA = 1
For Each k In RSIII
While RSIII.Cells(iSIII, 1).Value <> ""
opSIII = (RSIII.Cells(iSIII, 1).Value * 2) - 30 <--------- aquí es donde me dice "no coinciden tipos"
RSIII.Cells(iSIII, 1).Value = opSIII
iSIII = iSIII + 1
Wend
Next
For Each n In RSVI
While RSVI.Cells(iSVI, 1).Value <> ""
opSVI = (RSVI.Cells(iSVI, 1).Value * 2) - 20 <-------- esta y la de abajo funcionan bien
RSVI.Cells(iSVI, 1).Value = opSVI
iSVI = iSVI + 1
Wend
Next
For Each p In RSVIII
While RSVIII.Cells(iSVIII, 1).Value <> ""
opSVIII = (RSVIII.Cells(iSVIII, 1).Value * 2) - 17
RSVIII.Cells(iSVIII, 1).Value = opSVIII
iSVIII = iSVIII + 1
Wend
Next
For Each s In RTOTAL
While RTOTAL.Cells(iTOTAL, 1).Value <> ""
For Each celda In RFILA
opTOTAL = opTOTAL + RFILA.Cells(RFILA, iCOLUMNA).Value
iCOLUMNA = iCOLUMNA + 1
' iFILA2 = iFILA2 + 1
' iCOLUMNA2 = iCOLUMNA2 + 1
Next
RTOTAL.Cells(iTOTAL, 1).Value = opTOTAL
iTOTAL = iTOTAL + 1
iFILA = iFILA + 1
Wend
Next
End Sub
Valora esta pregunta


0