For my work, I'm trying to automate some analysis into a standard Excel file to do the work for me. I thought I had assembled the right code to do so.
What I'm looking for is just a sheet where I can put the source file export from my financial programm en turn that into a more complex version with additional formulas to add some fields and the add different pivots to it.
I've have written code to basicly clean wipe the sheet where I want the sourcefile to be copied to, then I want Excel to copy all the data from the sourcefile sheet to the new sheet and then add the formulas. I'm already getting an error on the first part.
I used the following code:
enter code here
Sub TransferSourcefile()
Dim EndRow, FirstRow
'TransferSourcefile
Sheets("Macro sortering").Select
Range("A4").Select
If Sheets("Macro sortering").Range("A4").Value > 0 Then
Selection.CurrentRegion.Select
EndRow = Selection.CurrentRegion.Rows.Count
Sheets("Macro sortering").Range("A4:AG" & EndRow).Select
Selection.ClearContents
End If
Sheets("Bronbestand").Select
Sheets("Bronbestand").Select
Range("A1").Select
Selection.End(xlDown).Select
EndRow = ActiveCell.Row
Range("A1:AE" & EndRow).Select
Selection.Copy
Sheets("Macro sortering").Select
Sheets("Macro sortering").Range("A4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
enter code here
Can you guys help me out?