#1
|
|||
|
|||
PtrSafe Attribute
Morning Guys!
just a newbie here. I opened an excel file in my pc, just forwarded from my colleague, this is an excel macro-enabled worksheet, when I open it in my pc and type in something, I am receiving this error: and this is what the module says: Code:
Option Explicit Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Sub formcheck1() Select Case Range("E" & "2").Value Case Is > 0 Call formcheck2 Case Else Call errorref End Select End Sub Sub formcheck2() Select Case Range("M" & "2").Value Case Is > 0 Call formcheck3 Case Else Call errorpost End Select End Sub Sub formcheck3() Select Case Range("E" & "3").Value Case Is > 0 Call master Case Else Call errororder End Select End Sub Sub formcheck4() Select Case Range("M" & "3").Value Case Is > 0 Call master Case Else Call errordate End Select End Sub Sub errorref() MsgBox "Please put reference into field", vbExclamation, "Idiot" End Sub Sub errorpost() MsgBox "Please put post code into field", vbExclamation, "Idiot" End Sub Sub errororder() MsgBox "Please put order number into field", vbExclamation, "Idiot" End Sub Sub errordate() MsgBox "Please put date into field", vbExclamation, "Idiot" End Sub Sub master() Worksheets("Packing").Activate ActiveWindow.SelectedSheets.PrintOut From:=1, To:=1, Copies:=2 Worksheets("Sheet1").Activate Clear End Sub Sub printstage1() Select Case Range("O" & "19").Value Case Is > 0 Call printsingleleg Call printstage2 Case Else Call printstage2 End Select End Sub Sub printstage2() Select Case Range("O" & "20").Value Case Is > 0 Call printdoubleleg Call printstage3 Case Else Call printstage3 End Select End Sub Sub printstage3() Select Case Range("O" & "23").Value Case Is > 0 Call printb25 Call printstage7 Case Else Call printstage4 End Select End Sub Sub printstage4() Select Case Range("O" & "24").Value Case Is > 0 Call printb25 Call printstage7 Case Else Call printstage5 End Select End Sub Sub printstage5() Select Case Range("O" & "25").Value Case Is > 0 Call printb25 Call printstage7 Case Else Call printstage6 End Select End Sub Sub printstage6() Select Case Range("O" & "26").Value Case Is > 0 Call printb25 Call printstage7 Case Else Call printstage7 End Select End Sub Sub printstage7() Select Case Range("O" & "27").Value Case Is > 0 Call printb68 Call printstage10 Case Else Call printstage8 End Select End Sub Sub printstage8() Select Case Range("O" & "28").Value Case Is > 0 Call printb68 Call printstage10 Case Else Call printstage9 End Select End Sub Sub printstage9() Select Case Range("O" & "29").Value Case Is > 0 Call printb68 Call printstage10 Case Else Call printstage10 End Select End Sub Sub printstage10() Select Case Range("O" & "30").Value Case Is > 0 Call printb910 Call printstage12 Case Else Call printstage11 End Select End Sub Sub printstage11() Select Case Range("O" & "31").Value Case Is > 0 Call printb910 Call printstage12 Case Else Call printstage12 End Select End Sub Sub printstage12() Select Case Range("O" & "32").Value Case Is > 0 Call printt23 Call printstage14 Case Else Call printstage13 End Select End Sub Sub printstage13() Select Case Range("O" & "33").Value Case Is > 0 Call printt23 Call printstage14 Case Else Call printstage14 End Select End Sub Sub printstage14() Select Case Range("O" & "34").Value Case Is > 0 Call printt45 Call printstage16 Case Else Call printstage15 End Select End Sub Sub printstage15() Select Case Range("O" & "35").Value Case Is > 0 Call printt45 Call printstage16 Case Else Call printstage16 End Select End Sub Sub printstage16() Select Case Range("O" & "36").Value Case Is > 0 Call printt67 Call printstage18 Case Else Call printstage17 End Select End Sub Sub printstage17() Select Case Range("O" & "37").Value Case Is > 0 Call printt67 Call printstage18 Case Else Call printstage18 End Select End Sub Sub printstage18() Select Case Range("O" & "38").Value Case Is > 0 Call printt810 Case Else Call printstage19 End Select End Sub Sub printstage19() Select Case Range("O" & "39").Value Case Is > 0 Call printt810 Case Else Call printstage20 End Select End Sub Sub printstage20() Select Case Range("O" & "40").Value Case Is > 0 Call printt810 Case Else End Select End Sub Public Function PrintThisDoc(formname As Long, FileName As String) On Error Resume Next Dim X As Long X = ShellExecute(formname, "Print", FileName, 0&, 0&, 3) End Function Sub m1() calloff End Sub Sub m2() stage2 End Sub Sub m3() stage3 End Sub Sub m4() stage4 End Sub Sub m5() stage5 End Sub Sub m6() stage6 End Sub Sub m7() stage7 End Sub Sub m8() stage8 End Sub Sub m9() stage9 End Sub Sub printb25() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "50x25 Box Bottom Rail-A4- 2-5 bed B011.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printb68() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "50x25 Box Bottom Rail-A4- 6-8 bed B011-1.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printb910() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "50x25 Box Bottom Rail-A4- 9 -10 B011-2.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printt23() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Top Rail-A4- 2-3 B012.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printt45() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Top Rail-A4- 4-5 B012-1.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printt67() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Top Rail-A4 - 6-7 B012-2.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printt810() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Top Rail-A4- 8-10 B012-3.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printsingleleg() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Legs-A4- Single post B010.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub printdoubleleg() Dim printThis Dim strDir As String Dim strFile As String strDir = "Z:\PDF Drawings\Bellsure\Double Decker" strFile = "100x100 Box Section Legs-A4- Double post B010-1.pdf" printThis = PrintThisDoc(0, strDir & "" & strFile) End Sub Sub Clear() ' ' Clear Macro ' ' Range("B6:B14").Select Selection.ClearContents Range("D6:D14").Select Selection.ClearContents Range("F6:F14").Select Selection.ClearContents Range("H6:H14").Select Selection.ClearContents Range("J6:J14").Select Selection.ClearContents Range("L6:L14").Select Selection.ClearContents Range("N6:N14").Select Selection.ClearContents Range("P6:P14").Select Selection.ClearContents Range("E2:H3").Select Selection.ClearContents Range("M2:M3").Select Selection.ClearContents End Sub Sub calloff() Select Case Range("O16").Value Case Is > 0 Call BottomTrough Case Else End Select End Sub Sub stage2() If Range("O17").Value > 0 Then Call TopTrough End If End Sub Sub stage3() If Range("O19").Value > 0 Then Call Eleg End If End Sub Sub stage4() If Range("O20").Value > 0 Then Call Mleg End If End Sub Sub stage5() If Range("O32").Value > 0 Then Call TT End If End Sub Sub stage6() If Range("O23").Value > 0 Then Call BB End If End Sub Sub stage7() If Range("O33").Value > 0 Then Call TTT End If End Sub Sub stage8() If Range("O24").Value > 0 Then Call BBB End If End Sub Sub stage9() If Range("O34").Value > 0 Then Call TTTT End If End Sub Sub stage10() If Range("O25").Value > 0 Then Call BBBB End If End Sub Sub stage11() If Range("O26").Value > 0 Then Call BBBBB End If End Sub Sub stage12() If Range("O27").Value > 0 Then Call BBBBBB End If End Sub Sub stage13() If Range("O28").Value > 0 Then Call BBBBBBB End If End Sub Sub stage14() If Range("O29").Value > 0 Then Call BBBBBBBB End If End Sub Sub stage15() If Range("O30").Value > 0 Then Call BBBBBBBBB End If End Sub Sub stage16() If Range("O31").Value > 0 Then Call BBBBBBBBBB End If End Sub Sub stage17() If Range("O35").Value > 0 Then Call TTTTT End If End Sub Sub stage18() If Range("O36").Value > 0 Then Call TTTTTT End If End Sub Sub stage19() If Range("O37").Value > 0 Then Call TTTTTTT End If End Sub Sub stage20() If Range("O38").Value > 0 Then Call TTTTTTTT End If End Sub Sub stage21() If Range("O39").Value > 0 Then Call TTTTTTTTT End If End Sub Sub stage22() If Range("O40").Value > 0 Then Call TTTTTTTTTT End If End Sub Sub TTTT() 'Copy the data Sheets("Sheet1").Range("O34").Copy 'Activate the destination worksheet Sheets("4 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("4 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("4 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("4 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("4 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBB() 'Copy the data Sheets("Sheet1").Range("O24").Copy 'Activate the destination worksheet Sheets("3 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("3 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("3 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("3 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("3 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTT() 'Copy the data Sheets("Sheet1").Range("O33").Copy 'Activate the destination worksheet Sheets("3 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("3 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("3 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("3 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("3 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BB() 'Copy the data Sheets("Sheet1").Range("O23").Copy 'Activate the destination worksheet Sheets("2 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("2 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("2 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("2 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("2 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TT() 'Copy the data Sheets("Sheet1").Range("O32").Copy 'Activate the destination worksheet Sheets("2 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("2 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("2 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("2 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("2 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TopTrough() 'Copy the data Sheets("Sheet1").Range("O17").Copy 'Activate the destination worksheet Sheets("Top Trough").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("Top Trough").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("Top Trough").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("Top Trough").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("Top Trough").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub Eleg() 'Copy the data Sheets("Sheet1").Range("O19").Copy 'Activate the destination worksheet Sheets("End Leg").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("End Leg").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("End Leg").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("End Leg").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("End Leg").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub Mleg() 'Copy the data Sheets("Sheet1").Range("O20").Copy 'Activate the destination worksheet Sheets("Middle Leg").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("Middle Leg").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("Middle Leg").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("Middle Leg").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("Middle Leg").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BottomTrough() 'Copy the data Sheets("Sheet1").Range("O16").Copy 'Activate the destination worksheet Sheets("Bottom Trough").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("Bottom Trough").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("Bottom Trough").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("Bottom Trough").Activate 'Select the target range Range("A17").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("Bottom Trough").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBB() 'Copy the data Sheets("Sheet1").Range("O25").Copy 'Activate the destination worksheet Sheets("4 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("4 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("4 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("4 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("4 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTT() 'Copy the data Sheets("Sheet1").Range("O35").Copy 'Activate the destination worksheet Sheets("5 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("5 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("5 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("5 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("5 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBB() 'Copy the data Sheets("Sheet1").Range("O26").Copy 'Activate the destination worksheet Sheets("5 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("5 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("5 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("5 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("5 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTTT() 'Copy the data Sheets("Sheet1").Range("O36").Copy 'Activate the destination worksheet Sheets("6 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("6 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("6 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("6 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("6 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBBB() 'Copy the data Sheets("Sheet1").Range("O27").Copy 'Activate the destination worksheet Sheets("6 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("6 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("6 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("6 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("6 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTTTT() 'Copy the data Sheets("Sheet1").Range("O37").Copy 'Activate the destination worksheet Sheets("7 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("7 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("7 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("7 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("7 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBBBB() 'Copy the data Sheets("Sheet1").Range("O28").Copy 'Activate the destination worksheet Sheets("7 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("7 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("7 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("7 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("7 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTTTTT() 'Copy the data Sheets("Sheet1").Range("O38").Copy 'Activate the destination worksheet Sheets("8 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("8 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("8 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("8 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("8 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBBBBB() 'Copy the data Sheets("Sheet1").Range("O29").Copy 'Activate the destination worksheet Sheets("8 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("8 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("8 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("8 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("8 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTTTTTT() 'Copy the data Sheets("Sheet1").Range("O39").Copy 'Activate the destination worksheet Sheets("9 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("9 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("9 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("9 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("9 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBBBBBB() 'Copy the data Sheets("Sheet1").Range("O30").Copy 'Activate the destination worksheet Sheets("9 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("9 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("9 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("9 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("9 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub TTTTTTTTTT() 'Copy the data Sheets("Sheet1").Range("O31").Copy 'Activate the destination worksheet Sheets("10 Bay Top").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("10 Bay Top").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("10 Bay Top").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("10 Bay Top").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("10 Bay Top").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub BBBBBBBBBB() 'Copy the data Sheets("Sheet1").Range("O31").Copy 'Activate the destination worksheet Sheets("10 Bay Bottom").Activate 'Select the target range Range("C15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Site Sheets("Sheet1").Range("M2").Copy 'Activate the destination worksheet Sheets("10 Bay Bottom").Activate 'Select the target range Range("E15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Project Sheets("Sheet1").Range("E2").Copy 'Activate the destination worksheet Sheets("10 Bay Bottom").Activate 'Select the target range Range("D15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Date Sheets("Sheet1").Range("M3").Copy 'Activate the destination worksheet Sheets("10 Bay Bottom").Activate 'Select the target range Range("A15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste 'Order No. Sheets("Sheet1").Range("E3").Copy 'Activate the destination worksheet Sheets("10 Bay Bottom").Activate 'Select the target range Range("B15").End(xlDown).Offset(1, 0).Select 'Paste in the target destination ActiveSheet.Paste Application.CutCopyMode = False Sheets("Sheet1").Activate End Sub Sub Macro3() ' ' Macro3 Macro ' ' Keyboard Shortcut: Ctrl+g ' Range("A16").Select ActiveCell.FormulaR1C1 = "Placeholder" Range("B16").Select ActiveCell.FormulaR1C1 = "Placeholder" Range("C16").Select ActiveCell.FormulaR1C1 = "Placeholder" Range("D16").Select ActiveCell.FormulaR1C1 = "Placeholder" Range("E16").Select ActiveCell.FormulaR1C1 = "Placeholder" Range("H25").Select End Sub What can i do with it? Thanks! Last edited by Pecoflyer; 08-03-2019 at 11:56 PM. |
#2
|
||||
|
||||
Welcome to the forum
I don't see any error, and when I tried Google Docs, it wouldn't let me in. Ask the colleague who sent it. |
#3
|
||||
|
||||
Hi and welcome
please wrap code with code tags ( the #button) I did it for you this time. Having no time so waste I did not tag the individual macros
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post Last edited by Pecoflyer; 08-05-2019 at 12:09 AM. |
#4
|
||||
|
||||
You will get that error if you run the code in the 64 bit version of VBA. Replace
Code:
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ ByVal hwnd As Long, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As Long Code:
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As LongPtr, _ ByVal lpOperation As String, _ ByVal lpFile As String, _ ByVal lpParameters As String, _ ByVal lpDirectory As String, _ ByVal nShowCmd As Long) As LongPtr
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting ".Text" value of XML Attribute Node Changes Node Index Order??? | gmaxey | Word VBA | 1 | 07-14-2019 11:48 AM |
Correct syntax for PtrSafe Function AccessibleObjectFromWindow | Paul Cain | Excel Programming | 2 | 11-19-2018 04:29 AM |
Ribbon button - showLabel attribute ignored | yiannis.spyridakis | Excel Programming | 2 | 06-12-2012 11:21 PM |
What slide attribute can I use in VBA to detect hidden slide? | mikel401 | PowerPoint | 1 | 02-22-2011 11:13 AM |