I am curious how I can get the following code to work. I keep getting an error at the line specified. I also have instructions as to what I am trying to do at the end. Thank you
Sub add_accounts()
'declaring variables
Dim i As Integer
Dim x As Integer
'selects the sheet
Sheets("Print_By_Model").Select
'clears the contents
Range("A8:A120").ClearContents
'adds the objects
x = Cells(2, 1)
Name = Cells(4, 1)
Dim c, a As Integer
'grabs the sheet to copy from
Sheets("Actual").Select
For i = 2 To 400
If Cells(i, 4) = Name Then
Cells(i, 1).Copy
'grabs the sheet to paste to
Sheets("Print_By_Model").Select
'this is the line i get a debug message on, i want it to paste into row 8 and so on...
Worksheets("Print_By_Model").Range("A8").End (xlDown)
Selection.Paste
End If
Next i
End Sub
' have two columns of data in one sheet,
'i want another sheet to look in that sheet in a column that matches a certain cell in the
'first sheet, then i want it to copy another column in the same row if it does match and
'paste it in the other sheet.
Sub add_accounts()
'declaring variables
Dim i As Integer
Dim x As Integer
'selects the sheet
Sheets("Print_By_Model").Select
'clears the contents
Range("A8:A120").ClearContents
'adds the objects
x = Cells(2, 1)
Name = Cells(4, 1)
Dim c, a As Integer
'grabs the sheet to copy from
Sheets("Actual").Select
For i = 2 To 400
If Cells(i, 4) = Name Then
Cells(i, 1).Copy
'grabs the sheet to paste to
Sheets("Print_By_Model").Select
'this is the line i get a debug message on, i want it to paste into row 8 and so on...
Worksheets("Print_By_Model").Range("A8").End (xlDown)
Selection.Paste
End If
Next i
End Sub
' have two columns of data in one sheet,
'i want another sheet to look in that sheet in a column that matches a certain cell in the
'first sheet, then i want it to copy another column in the same row if it does match and
'paste it in the other sheet.