Ver Mensaje Individual
  #7 (permalink)  
Antiguo 13/03/2006, 05:27
Avatar de niconico
niconico
 
Fecha de Ingreso: enero-2006
Mensajes: 166
Antigüedad: 18 años, 4 meses
Puntos: 0
En el código le mando que salga el msgbox con dos botones si le doy a aceptar me imprime y si le doy a cancelar me lleva a la hoja que le ordeno pero mi imprime de todas formas. El resto del código (que me había pasado 3pies y que yo adapte a mi herremienta) establece que solo debe imprimir aquellas celdas de aquellas hojas (las cuales yo he indicado en el código) que están rellenadas.


Sub Imprimir_solo_si_hay_datos()


msbTexto = "Vas a imprimir einnnn? estás seguro?"
msbTitu = "Hola"
msbOpc = vbOKCancel + vbQuestion + vbDefaultButton1
msbRespuesta = MsgBox(msbTexto, msbOpc, msbTitu)
Select Case msbRespuesta
Case vbOK 'Aceptar
ActiveWindow.SelectedSheets.PrintOut Copies:=1
Case vbCancel 'Cancelar
Sheets("hoja2").Select
Range("A1").Select
End Select

Application.ScreenUpdating = False

Hoja1.Select

For i = 1 To Sheets.Count

If i = 1 Then If Range("d7") <> "" Then ActiveWindow.SelectedSheets.PrintOut Copies:=1
ElseIf i = 4 Then If Range("d68") <> "" Then ActiveWindow.SelectedSheets.PrintOut Copies:=1

ElseIf i = 2 Then
If Range("b17") <> "" Then ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=1
If Range("b39") <> "" Then ActiveWindow.SelectedSheets.PrintOut From:=2, To:=2, Copies:=1
If Range("b61") <> "" Then ActiveWindow.SelectedSheets.PrintOut From:=3, To:=3, Copies:=1
If Range("b83") <> "" Then ActiveWindow.SelectedSheets.PrintOut From:=4, To:=4, Copies:=1
End If
If i < Sheets.Count Then ActiveSheet.Next.Select
Next

Application.ScreenUpdating = True
Sheets("menuprincipal").Select
Range("A1").Select
End Sub


no sé cual puede ser el problema??