Excel - No jala los datos de la hoja

 
Vista:

No jala los datos de la hoja

Publicado por Cecilia (3 intervenciones) el 15/07/2008 17:21:07
Hola!!!

Quisiera que me pudieran ayudar nuevamente. El problema que tengo es el siguiente.
En la siguiente tabla de datos que se encuentra en la hoja denominada "Cuadricula" , en vez de que salgan ceros tienen que salir datos jalados de otras hojas de excel y no me sale ni los datos ni su totales. Quisiera que me pudieran ayudar

N Empleados Integro. Liquid. Dto. S.S. I.R.P.F.
CTRL - INS - CCIAL - CCIAL 3 0.00 0.00 0.00 0.00
CTRL - INS - CCIAL - OF 4 0.00 0.00 0.00 0.00
CTRL - INS - CCIAL - OTR 2 0.00 0.00 0.00 0.00
CTRL - INS - CCIAL - LOG 4 0.00 0.00 0.00 0.00
CTRL - INS - CCIAL - DTR 1 0.00 0.00 0.00 0.00
TOTAL SERV. CENTRALES 14 0.00 0.00 0.00 0.00
AV - INS - CCIAL - CCIAL 2 0.00 0.00 0.00 0.00
AV - LIB - CCIAL - DEP 3 0.00 0.00 0.00 0.00
AV - LIB - CCIAL - DTR 1 0.00 0.00 0.00 0.00
AV - LIB - CCIAL - LOG 2 0.00 0.00 0.00 0.00
TOTAL A CORUΡA 8 0.00 0.00 0.00 0.00
y asi sucesivamenteee.......

Aqui les pongo el codigo de la macro es bastante largo y en verdad espero que me puedan ayudar!!!! Y poder saber donde se tiene que modificar para que salgan datos.
Si necesitan el excel donde se encuentra la BD se las puedo proporcionar.... Muchas gracias por tu ayudaa!!!

---------------------------------------------------------------------------------------------------------------------------
Sub BarreProfesActivos(clave, Nombre, Indice, NumHoja As Worksheet)
IndiceInic = Indice
For i = 1 To BuscaFinal(Hoja1)
If Left(Hoja2.Range("A" & i), 2) = clave Then
NumHoja.Range("A" & Indice).Value = Hoja2.Range("A" & i).Value
NumHoja.Range("B" & Indice).FormulaLocal = "=CONTAR.SI('Tabla Datos'!C:C;A" & Indice & ")"
NumHoja.Range("C" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!E:E)"
NumHoja.Range("D" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!F:F)"
NumHoja.Range("E" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!G:G)"
NumHoja.Range("F" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!H:H)"
NumHoja.Range("G" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!I:I)"
Indice = Indice + 1
End If
Next i
'Poner el formato
Indice = Indice - 1
With NumHoja.Range("A" & Indice)
'.Value = "TOTAL " & Nombre
.Font.Size = 10
.Font.Bold = True
.Font.Italic = True
.HorizontalAlignment = xlRight
End With
With NumHoja.Range("B" & Indice)
'.FormulaLocal = "=SUMA(B" & IndiceInic & ":B" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("C" & Indice)
'.FormulaLocal = "=SUMA(C" & IndiceInic & ":C" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("D" & Indice)
'.FormulaLocal = "=SUMA(D" & IndiceInic & ":D" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("E" & Indice)
'.FormulaLocal = "=SUMA(E" & IndiceInic & ":E" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("F" & Indice)
'.FormulaLocal = "=SUMA(F" & IndiceInic & ":F" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("G" & Indice)
'.FormulaLocal = "=SUMA(G" & IndiceInic & ":G" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With

Indice = Indice + 1

'poner los activos
With NumHoja.Range("A" & Indice)
.Value = "Activos"
.Font.Size = 10
.Font.Bold = True
.Font.Italic = True
.HorizontalAlignment = xlRight
End With
With NumHoja.Range("B" & Indice)
.FormulaLocal = "=CONTAR.SI(DESREF('Tabla Datos'!C:C;COINCIDIR(A" & Indice - 1 & ";'Tabla Datos'!C:C;0)-1;6;COINCIDIR(A" & Indice - 1 & ";'Tabla Datos'!C:C;1)-COINCIDIR(A" & Indice - 1 & ";'Tabla Datos'!C:C;0)+1;1);""<>0"")"
.Font.Bold = True
.Font.Italic = True
End With

Indice = Indice + 1

End Sub
Function BuscaActivos(Nombre)
cuenta = 0
For i = 1 To BuscaFinal(Hoja2)
If Hoja2.Range("C" & i).Value = Nombre And Hoja2.Range("I" & i).Value <> 0 Then cuenta = cuenta + 1 Else
Next i
BuscaActivos = cuenta
End Function

Sub BarreEmpresa(clave1, clave2, Nombre, Indice, NumHoja As Worksheet)
IndiceInic = Indice
For i = 1 To BuscaFinal(Hoja1)
If (Left(Hoja2.Range("A" & i), 2) = clave1) Or (Left(Hoja2.Range("A" & i), 2) = clave2) Then
NumHoja.Range("A" & Indice).Value = Hoja2.Range("A" & i).Value
NumHoja.Range("B" & Indice).FormulaLocal = "=CONTAR.SI('Tabla Datos'!A:A;A" & Indice & ")"
NumHoja.Range("C" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!D:D)"
NumHoja.Range("D" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!E:E)"
NumHoja.Range("E" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!F:F)"
' NumHoja.Range("F" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!H:H)"
' NumHoja.Range("G" & Indice).FormulaLocal = "=SUMAR.SI('Tabla Datos'!C:C;A" & Indice & ";'Tabla Datos'!I:I)"
Indice = Indice + 1
End If
Next i
'Resumen
With NumHoja.Range("A" & Indice)
.Value = "TOTAL " & Nombre
.Font.Size = 10
.Font.Bold = True
.Font.Italic = True
.HorizontalAlignment = xlRight
End With
With NumHoja.Range("B" & Indice)
.FormulaLocal = "=SUMA(B" & IndiceInic & ":B" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("C" & Indice)
.FormulaLocal = "=SUMA(C" & IndiceInic & ":C" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("D" & Indice)
.FormulaLocal = "=SUMA(D" & IndiceInic & ":D" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
With NumHoja.Range("E" & Indice)
.FormulaLocal = "=SUMA(E" & IndiceInic & ":E" & Indice - 1 & ")"
.Font.Bold = True
'.Font.Italic = True
End With
' With NumHoja.Range("F" & Indice)
' .FormulaLocal = "=SUMA(F" & IndiceInic & ":F" & Indice - 1 & ")"
' .Font.Bold = True
' '.Font.Italic = True
' End With
' With NumHoja.Range("G" & Indice)
' .FormulaLocal = "=SUMA(G" & IndiceInic & ":G" & Indice - 1 & ")"
' .Font.Bold = True
' '.Font.Italic = True
' End With

Indice = Indice + 1

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:No jala los datos de la hoja

Publicado por Octavio Illescas (46 intervenciones) el 16/07/2008 16:08:13
Me mandas tu archivo tal vez te pueda ayudar
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar