What I'm trying to do is to put a table in a sheet and have a macro autofill the information in a database, but when I get to the point of dragging down numbers (not formulas) in a column I get the error 1004, I have also tried other ways which sometimes won't throw me an error but won't do what I want.
My logic is this: first fill the info from the input sheet to the database sheet (this part works) Then count how many rows the part of the database that was recently populated to count the new number of rows to use as destination (it's counting correctly). Then drag a column to complete the information, this is what isn't working.
Here's the code:
Sub Macro1()
Dim Size As Integer
Dim L As Integer
Sheets("DATABASE").Activate
L = (Range("C11").End(xlDown).Row)
MsgBox (L)
Sheets("Input Sheet").Activate
Size = (Range("B2").End(xlDown).Row) - 2
MsgBox (Size)
**This is filling the info from the input sheet to the database**
Range("B3:C3" & Size).Cut Sheets("DATABASE").Range("C1:D1").Offset(L, 0)
Range("D3:D3" & Size).Cut Sheets("DATABASE").Range("F1").Offset(L, 0) '
Range("E3:E3" & Size).Cut Sheets("DATABASE").Range("K1").Offset(L, 0) '
Range("F3:F3" & Size).Cut Sheets("DATABASE").Range("AJ1").Offset(L, 0) '
Sheets("DATABASE").Activate
Size = (Range("C11").End(xlDown).Row)
MsgBox (Size)
Range("B11:B11" & L).Select
**This is where I get the error**
Selection.AutoFill Destination:=Range("B11:B" & Size), Type:=xlFillDefault
End Sub