E
Esrei
This is the macro I recorded and copied from replies I
got to make up one lager macro.
At:
Dim RowNdx As Long
Dim Last Row as Long
I got stuck, the debugger messages is:
"Duplicate declaration in current scope"
I have never written macro's only recorded them so I only
starting to understand what I am reading.
This is the whole macro:
Pasteldata Macro
' Macro recorded 26/04/2004 by Esrei A Engelbrecht
'
'
Range("B3:B1000").Select
Selection.Copy
Sheets("Pastel STinv").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel GLinv").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("C3:C1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("J2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("E3:E1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("F3:F999").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel GLinv").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("J3:J1066").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("F2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("K3:K1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("N3:N1086").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel GLinv").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Range("E2").Select
ActiveSheet.Paste
End Sub
Sub Pasteldata2()
'
' Pasteldata2 Macro
' Macro recorded 26/04/2004 by Esrei A Engelbrecht
'
'
Range("A2:N1039").Select
Selection.Copy
Sheets("Pastel GLinv").Select
Application.Goto Reference:="R1000C1"
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.Goto Reference:="R3C1"
ActiveWindow.SmallScroll Down:=-15
Range("A2:O2038").Select
Application.CutCopyMode = False
Selection.SORT Key1:=Range("A2"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Dim LastRow As Long
Dim row_index As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = LastRow - 1 To 2 Step -1
If Cells(row_index, "A").Value <> _
Cells(row_index + 1, "A").Value Then
Cells(row_index + 1, "A").EntireRow.insert _
(xlShiftDown)
Rows(1).Copy Destination:=Rows(row_index + 1)
End If
Next
Application.ScreenUpdating = True
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("DELIVERIES").Select
Range("A2").Select
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
With Cells(RowNdx, "A")
If .Value <> "Header" And _
.Value <> "" Then
.Value = "Detail"
End If
End With
Next RowNdx
Application.ScreenUpdating = True
End Sub
got to make up one lager macro.
At:
Dim RowNdx As Long
Dim Last Row as Long
I got stuck, the debugger messages is:
"Duplicate declaration in current scope"
I have never written macro's only recorded them so I only
starting to understand what I am reading.
This is the whole macro:
Pasteldata Macro
' Macro recorded 26/04/2004 by Esrei A Engelbrecht
'
'
Range("B3:B1000").Select
Selection.Copy
Sheets("Pastel STinv").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel GLinv").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("C3:C1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("J2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("E3:E1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("F3:F999").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel GLinv").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("J3:J1066").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("F2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("K3:K1000").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel STinv").Select
Range("C2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Pastel").Select
Application.Goto Reference:="R3C2"
Range("N3:N1086").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Pastel GLinv").Select
Range("B2").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Range("D2").Select
ActiveSheet.Paste
Range("E2").Select
ActiveSheet.Paste
End Sub
Sub Pasteldata2()
'
' Pasteldata2 Macro
' Macro recorded 26/04/2004 by Esrei A Engelbrecht
'
'
Range("A2:N1039").Select
Selection.Copy
Sheets("Pastel GLinv").Select
Application.Goto Reference:="R1000C1"
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.Goto Reference:="R3C1"
ActiveWindow.SmallScroll Down:=-15
Range("A2:O2038").Select
Application.CutCopyMode = False
Selection.SORT Key1:=Range("A2"),
Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
Dim LastRow As Long
Dim row_index As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = LastRow - 1 To 2 Step -1
If Cells(row_index, "A").Value <> _
Cells(row_index + 1, "A").Value Then
Cells(row_index + 1, "A").EntireRow.insert _
(xlShiftDown)
Rows(1).Copy Destination:=Rows(row_index + 1)
End If
Next
Application.ScreenUpdating = True
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("DELIVERIES").Select
Range("A2").Select
Dim RowNdx As Long
Dim LastRow As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
With Cells(RowNdx, "A")
If .Value <> "Header" And _
.Value <> "" Then
.Value = "Detail"
End If
End With
Next RowNdx
Application.ScreenUpdating = True
End Sub