macro impression

chinel

XLDnaute Impliqué
Salut tout le monde!

j'ai un problème car je n'arrive pas à sélectionner mes cellules de A4 à M45
il m'imprime toute ma feuille

voici mon code :
sub imprimer ()
Range("A4:M45").Select
rep = InputBox("nombre d'impression", , 1)
If Not (IsNumeric(rep)) Or rep = "" Or rep < 1 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=rep
end sub

merci à tous !
 

CB60

XLDnaute Barbatruc
Re : macro impression

Bonsoir
Je pense que tu devrais mttre dans ta macro cela:
Code:
sub imprimer ()
ActiveSheet.PageSetup.PrintArea = "$A$4:$M$45"
rep = InputBox("nombre d'impression", , 1)
If Not (IsNumeric(rep)) Or rep = "" Or rep < 1 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=rep
end sub
 

jeanpierre

Nous a quitté
Repose en paix
Re : macro impression

Bonsoir chinel,

essaie plutôt :

Sub imprimer()

rep = InputBox("nombre d'impression", , 1)
If Not (IsNumeric(rep)) Or rep = "" Or rep < 1 Then Exit Sub
Range("A4:M45").Select
With Selection
.PrintOut Copies:=rep
End With
End Sub

Tu nous dis.

Bonne soirée.

Jean-Pierre

Edit : Bonsoir Bruno, PrintArea bien sûr.
 
Dernière édition:

myDearFriend!

XLDnaute Barbatruc
Re : macro impression

Bonsoir chinel, CB60, jeanpierre,

Un peu tardivement, je me permets d'ajouter une version supplémentaire :
Code:
[COLOR=NAVY]Sub[/COLOR] imprimer()
[COLOR=NAVY]Dim[/COLOR] Rep [COLOR=NAVY]As Integer[/COLOR]
    Rep = Application.InputBox(Prompt:="Nombre de copies", Title:="Impression", [COLOR=NAVY]Type[/COLOR]:=1)
    [COLOR=NAVY]If[/COLOR] Rep > 0 [COLOR=NAVY]Then[/COLOR] Range("A4:M45").PrintOut Copies:=Rep
[COLOR=NAVY]End Sub[/COLOR]
Cordialement,
 

kromitou

XLDnaute Occasionnel
Re : macro impression

Private Sub CommandButton3_Click()
Sheets("Bureau de Controle").Select
Application.ActivePrinter = _
"\\srvxxxx.xxxxx.local\RICOH Aficio 1060 RPCS sur Nexx:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"\\srvcompobat.compobat.local\RICOH Aficio 1060 RPCS sur Nexx:", Collate:= _
True
End Sub

Voila ce p'tit code me permet d'imprimer sur l'imprimante de mon serveur... donc à priori ça fonctionne...mais comment choisir le Bac N°3 ????

Merci d'avance si quelqu'un à une p'tite réponse...
 

Discussions similaires

Réponses
4
Affichages
395
Réponses
8
Affichages
531

Statistiques des forums

Discussions
312 488
Messages
2 088 860
Membres
103 978
dernier inscrit
bderradji