我得到了Loop,下一部分来自录制的宏。但是我想把它们放到同一个宏中,在这里我被困住了。 有什么想法吗?
Sub SkapaPDF()
'
' SkapaPDF Macro
'
Dim ws, ws1 As Worksheet
Dim LastRow As Long
Set ws = Sheets("Uträkning")
Set ws1 = Sheets("TillPDF")
'Application.ScreenUpdating = False
Sheets("TillPdf").Select
ws1.Rows("2:2").Select
Do Until IsEmpty(ActiveCell.Value)
Sheets("TillPdf").Select
ws1.Rows("2:2").Select
Selection.Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows(ActiveCell.Row).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ws1.Rows("2:2").Select
Selection.Copy
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
ActiveCell.End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows(ActiveCell.Row).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A" & Rows.Count).End(xlUp).Select
If ActiveCell.Value = "0" Then Exit Sub
Loop
Application.ScreenUpdating = True
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("PDF").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("3:3").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range(Selection, Selection.End(xlDown)).Select
Sheets("PDF").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:="\\naspri01tsivz2.tcad.telia.se\TS-Home136$\lrc691\Documents\Kemikalieskatt\Kemikalieskatt &ActiveCell(Q1).pdf", _
OpenAfterPublish:=True
End Sub