Hi, i have a problem with macro used for printing labels from excel.
Generally, the idea is to copy info about items to sheet "temp" where
list is made and after it each row from this sheet is pasted into
sheet "Wydruk"( which is adjusted to special paper so only 16 rows can
be pasted to make 16 labels). When we need to print more labels macro
starts next loop etc. Now i tried to change it: instead of description
(e.g. BOX) put on the printout the image of a box or single PCS using
OLE object. It is working till 16 labels. More labels cause problem
with loop- when i wanted e.g. 18 labels it filled first 2 labels with
17th and 18th row, 3rd label was clear because of condition set in
procedure, and the rest( from 4 to 16 place on sheet "Wydruk") was
from first page which wasn't printed. To sum up, only 1 page is
printed, nonetheless the fact that it should be more- on the printout
i have everything from last page and sth from previous pages. Maybe sb
will have idea how to connect printing with this loop


Sub PrintItOut()
    Dim LastRow As Long
    Dim TLoop As Long
    Dim CLoop As Long
    Dim PLoop As Long
    Dim CRow As Long
    Dim n As Long
    Dim Shp As OLEObject
    Dim sciezka   As String
    Dim wzorzec   As String
    Dim trgRng As Range

    Application.ScreenUpdating = False

    '************************************************
    'deletes old temp
   On Error Resume Next
    Application.DisplayAlerts = False
        Sheets("Temp").Delete
    Application.DisplayAlerts = True
    On Error GoTo 0
    '***************************************************


    Sheets.Add After:=Sheets(Sheets.Count)
    Sheets(Sheets.Count).Name = "Temp"

    Sheets("lokalizacje").Select
    LastRow = Cells(Rows.Count, 1).End(xlUp).Row


    CRow = 1


    'copying data into temp
    For TLoop = 3 To LastRow
        If IsError(Cells(TLoop, 17).Value) Then GoTo skipIt
            If Cells(TLoop, 19).Value = "" Then Exit For
                Range(Cells(TLoop, 19), Cells(TLoop, 20)).Copy
                    For CLoop = 1 To Cells(TLoop, 21).Value
                        With Sheets("Temp").Cells(CRow, 1)
                            .PasteSpecial xlValues
                        End With
                            CRow = CRow + 1
                    Next CLoop
skipIt:
    Next TLoop


    n = 1

    Sheets("Temp").Select


    Do Until Cells(n, 1).Value = ""

            Sheets("Wydruk").Range("B1:C16").ClearContents
            Sheets("Wydruk").Range("E1:F16").ClearContents
               For Each Shp In Sheets("Wydruk").OLEObjects

                            Shp.Delete

                        Next Shp


nast:
Do Until Cells(n, 1).Value = ""
    '1
            Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
                Sheets("Wydruk").Range("B1").PasteSpecial
Paste:=xlValues, _
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                  If Sheets("Wydruk").Range("C1").Value = "BOX" Then

                    sciezka = ThisWorkbook.Path & "\"
                    wzorzec = sciezka & "BOX.jpg"
                  Else
                    If Sheets("Wydruk").Range("C1").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"

                    Else
                       GoTo nast

                    End If

                  End If

                    Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C1").Left + 50, _
                                                             Top:=Range
("C1").Top + 5, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'or fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With


            n = n + 1
'2
            Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
                Sheets("Wydruk").Range("E1").PasteSpecial
Paste:=xlValues, _
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("F1").Value = "BOX"
Then

                            sciezka = ThisWorkbook.Path & "\"
                            wzorzec = sciezka & "BOX.jpg"
                            Else
                            If Sheets("Wydruk").Range("F1").Value =
"PCS" Then
                            sciezka = ThisWorkbook.Path & "\"
                            wzorzec = sciezka & "PCS.jpg"
                            Else
                            GoTo nast

                            End If
                            End If
                            Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F1").Left + 175, _
                                                             Top:=Range
("F1").Top + 5, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With


            n = n + 1
'3
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
                Sheets("Wydruk").Range("B2").PasteSpecial
Paste:=xlValues, _
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("C2").Value = "BOX"
Then

                            sciezka = ThisWorkbook.Path & "\"
                            wzorzec = sciezka & "BOX.jpg"
                               Else
                    If Sheets("Wydruk").Range("C2").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
                            End If
                            Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C2").Left + 50, _
                                                             Top:=Range
("C2").Top + 90, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With

            n = n + 1
'4
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E2").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("F2").Value = "BOX"
Then

                        sciezka = ThisWorkbook.Path & "\"
                        wzorzec = sciezka & "BOX.jpg"
                         Else
                    If Sheets("Wydruk").Range("F2").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                       Sheets("Wydruk").PrintOut
                    End If
                    End If

                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F2").Left + 175, _
                                                             Top:=Range
("F2").Top + 90, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With

             n = n + 1
    '5
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B3").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("C3").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C3").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C3").Left + 50, _
                                                             Top:=Range
("C3").Top + 177, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With

             n = n + 1
   '6
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E3").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("F3").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F3").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F3").Left + 175, _
                                                             Top:=Range
("F3").Top + 177, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With

             n = n + 1
  '7
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B4").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("C4").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C4").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False


                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C4").Left + 50, _
                                                             Top:=Range
("C4").Top + 262, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
   '8
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E4").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("F4").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F4").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F4").Left + 175, _
                                                             Top:=Range
("F4").Top + 262, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '9
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B5").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("C5").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C5").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C5").Left + 50, _
                                                             Top:=Range
("C5").Top + 347, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '10
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E5").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("F5").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F5").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F5").Left + 175, _
                                                             Top:=Range
("F5").Top + 347, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '11
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B6").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                        If Sheets("Wydruk").Range("C6").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C6").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C6").Left + 50, _
                                                             Top:=Range
("C6").Top + 435, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '12
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E6").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                       If Sheets("Wydruk").Range("F6").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F6").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F6").Left + 175, _
                                                             Top:=Range
("F6").Top + 435, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '13
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B7").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                       If Sheets("Wydruk").Range("C7").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C7").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C7").Left + 50, _
                                                             Top:=Range
("C7").Top + 520, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
 '14
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E7").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                       If Sheets("Wydruk").Range("F7").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F7").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False


                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F7").Left + 175, _
                                                             Top:=Range
("F7").Top + 520, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
  '15
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("B8").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                       If Sheets("Wydruk").Range("C8").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("C8").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("C8").Left + 50, _
                                                             Top:=Range
("C8").Top + 610, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1
   '16
             Range(Cells(PLoop + n, 1), Cells(n, 2)).Copy
            Sheets("Wydruk").Range("E8").PasteSpecial Paste:=xlValues,
_
                    Operation:=xlNone, SkipBlanks:= _
                        False, Transpose:=False
                       If Sheets("Wydruk").Range("F8").Value = "BOX"
Then

            sciezka = ThisWorkbook.Path & "\"
            wzorzec = sciezka & "BOX.jpg"
            Else
            If Sheets("Wydruk").Range("F8").Value = "PCS" Then
                       sciezka = ThisWorkbook.Path & "\"
                       wzorzec = sciezka & "PCS.jpg"
                       Else
                       GoTo nast
                    End If
            End If
                Application.ScreenUpdating = False



                        Set Shp = Sheets("Wydruk").OLEObjects.Add
(ClassType:="Forms.Image.1", Link:=False, _
 
DisplayAsIcon:=False, Left:=Range("F8").Left + 175, _
                                                             Top:=Range
("F8").Top + 610, Width:=120, Height:=90)
                        With Shp.Object
                          .PictureSizeMode = fmPictureSizeModeZoom
'lub fmPictureSizeModeStretch
                          On Error Resume Next

                          .Picture = LoadPicture(wzorzec)
                          'If Err.Number <> 0 Then
                            'Err.Clear
                            'wzorzec = sciezka & "Brak obrazka.jpg"
                            '.Picture = LoadPicture(wzorzec)
                          'End If
                        End With
             n = n + 1

            Sheets("Wydruk").PrintOut
            DoEvents

     Loop
   Loop


    Application.DisplayAlerts = False
        'Sheets("Temp").Delete
    Application.DisplayAlerts = True

    Sheets("lokalizacje").Select

    Application.ScreenUpdating = True

End Sub

--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to