Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Excel will not paste clipboard material using VBA

$
0
0
Hello,

Currently, I have some code that takes data from a user selected excel workbook and imports it into a master data list (where the macro is run from)

My code, listed below, does not allow me to paste the copied material into the cell I indicate. I have been searching the internet and attempting many different methods. I am hoping someone can assist me with my problem. The code that is highlighted in debugger mode is ActiveSheet.Paste (bolded below)

Thank you in advance.

Best regards,

Grazian2


Code

Sub GetData()

Application.DisplayAlerts = False
Application.ScreenUpdating = False

File = Application.GetOpenFilename

Workbooks.Open (File)

Range("A:Y").Select
'Turns off autofilter
Selection.AutoFilter
Range("A:Y").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy



'Goes to first open cell in column
Windows("Combined_List_Chargebacks.xlsm").Activate
Worksheets("Raw Data").Activate

Dim finalRow As Integer
finalRow = ActiveSheet.UsedRange.Rows.Count

If finalRow = 0 Then
finalRow = 1
End If

Dim FreeRow As Integer

'Finds first open row and pastes new data there
FreeRow = Cells(Rows.Count, "A").End(xlUp).Offset(1).Row
Cells(FreeRow, 1).Select
ActiveSheet.Paste
Cells(FreeRow, 1).EntireRow.Delete

'Gets rid of all highlighted cells
Cells.Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With

Windows(Dir(File)).Close

Call Rename
Call RenameMember


Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

Viewing all articles
Browse latest Browse all 50090

Trending Articles