HI All -
I am having an issue running my macro. It works when i paste data with multiple lines but when i paste data with only two lines i get an error. It seems when i paste special it stops running. Can someone take a look? I get an error on this line in bold below:
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
heres the code:
I am having an issue running my macro. It works when i paste data with multiple lines but when i paste data with only two lines i get an error. It seems when i paste special it stops running. Can someone take a look? I get an error on this line in bold below:
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
heres the code:
Rich (BB code):
Sub Deliver_Units()
Sheets("Deliver_Units").Select
Range("A1").Select
ActiveCell.Value2 = "DWAC Withdrawal_Deliver_Units_" & Date
Selection.NumberFormat = "yyyymmdd"
Range("A2").Select
ActiveCell.Value2 = "dwac"
Range("A3").Select
ActiveCell.Value2 = "account_id"
Range("B3").Select
ActiveCell.Value2 = "segment"
Range("C3").Select
ActiveCell.Value2 = "instrument.identifier"
Range("D3").Select
ActiveCell.Value2 = "currency"
Range("E3").Select
ActiveCell.Value2 = "instrument.identifier_type"
Range("F3").Select
ActiveCell.Value2 = "instrument.currency"
Range("G3").Select
ActiveCell.Value2 = "instrument.country"
Range("H3").Select
ActiveCell.Value2 = "position"
Range("I3").Select
ActiveCell.Value2 = "balance"
Sheets("DWAC").Select
Range("A1").Select
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Deliver_Units").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B4").Select
ActiveCell.Value2 = "margin"
Range("B4").AutoFill Range("B4:B" & Range("A" & Rows.Count).End(xlUp).Row)
Sheets("DWAC").Select
Range("E1").Select
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Deliver_Units").Select
Range("C4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D4").Select
ActiveCell.Value2 = "USD"
Range("D4").AutoFill Range("D4:D" & Range("A" & Rows.Count).End(xlUp).Row)
Range("E4").Select
ActiveCell.Value2 = "cusip"
Range("E4").AutoFill Range("E4:E" & Range("A" & Rows.Count).End(xlUp).Row)
Range("F4").Select
ActiveCell.Value2 = "USD"
Range("F4").AutoFill Range("F4:F" & Range("A" & Rows.Count).End(xlUp).Row)
Range("G4").Select
ActiveCell.Value2 = "USA"
Range("G4").AutoFill Range("G4:G" & Range("A" & Rows.Count).End(xlUp).Row)
Sheets("DWAC").Select
Range("H1").Select
ActiveCell.Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Deliver_Units").Select
Range("H4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("J4").Select
ActiveCell.FormulaR1C1 = "=RC[-2]*-1"
Range("J4").AutoFill Range("J4:J" & Range("A" & Rows.Count).End(xlUp).Row)
Range("J4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("H4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I4").Select
ActiveCell.Value2 = "0"
Range("I4").AutoFill Range("I4:I" & Range("A" & Rows.Count).End(xlUp).Row)
'DTCF
Range("J4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("H4").End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C4:G4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Range("C4").End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("I4").End(xlDown).Select
Range("I4").AutoFill Range("I4:I" & Range("H" & Rows.Count).End(xlUp).Row)
Range("C4").Select
Selection.End(xlDown).Select
ActiveCell.Select
ActiveCell.Offset(-1, -2).Select
ActiveCell.Value2 = "100002"
Selection.Copy
Range(Selection, Selection.End(xlUp)).Select
Selection.Offset(1, 0).Select
ActiveSheet.Paste
Range("C4").Select
Selection.End(xlDown).Select
ActiveCell.Select
ActiveCell.Offset(-1, -1).Select
ActiveCell.Value2 = "dtcf"
Selection.Copy
Range(Selection, Selection.End(xlUp)).Select
Selection.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Select
Columns("J:J").Select
Selection.Delete Shift:=xlToLeft
Sheets("INX").Select
MsgBox "Withdrawal/Deliver Units Done"
End Sub