I'm getting a Runtime 1004 error on my macro. I orginially recorded the macro, then created a separate sub since I want to run the macro for multiple sheets. The 1 parameter for the Sub is a String that contains the Worksheet name.
What I'm trying to do is copy data from multiple sheets into 1 sheet. There are varying rows of data in each sheet.
Here is the start of the code, the bolded line is where I get the error. I select the A6 where every sheet starts the list I want to copy. Then I want to select the entire list and copy it to paste over. Everything worked when I just recorded a macro for 1 sheet. I did that just to get a basis to create a template so I could do this for every sheet.
What I'm trying to do is copy data from multiple sheets into 1 sheet. There are varying rows of data in each sheet.
Here is the start of the code, the bolded line is where I get the error. I select the A6 where every sheet starts the list I want to copy. Then I want to select the entire list and copy it to paste over. Everything worked when I just recorded a macro for 1 sheet. I did that just to get a basis to create a template so I could do this for every sheet.
Code:
Sub CreateOutput(SheetNm As String)
Dim SheetName As String
SheetName = SheetNm
Dim RowCount As Integer
RowCount = Range("I1").Value
Dim RowCountAbs As Integer
Sheets(SheetName).Select
ActiveSheet.Range("A6").Select
[b]ActiveSheet.Range(Selection, Selection.End(x1Down)).Select[/b]
Selection.Copy
Sheets("Upload2").Select