Hi Guys,
im trying to copy rows from one sheet to another based on their rating, Rating is in column E (Long,medium or short) and i have 3 sheets with each name.
I have a list with movies and based on their rating i want the entire row to be copied on the specific sheet.
here is my code.
i get the error from the title of the thread and this row is highlighted ,,Worksheets(Filmrating).Activate,,
Do you have any idea how should i fix this?
Thank you and regards,
Ossian
im trying to copy rows from one sheet to another based on their rating, Rating is in column E (Long,medium or short) and i have 3 sheets with each name.
I have a list with movies and based on their rating i want the entire row to be copied on the specific sheet.
here is my code.
Code:
Sub Lup2()
Dim FilmLength As Integer, Filmrating As String, LastRow As Long, i As Integer, film As Workbook
Application.ScreenUpdating = False
Set film = ActiveWorkbook
LastRow = film.Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
' MsgBox film.Worksheets("Sheet1").Range("D" & i).Value
If film.Worksheets("Sheet1").Range("D" & i).Value < 150 And film.Worksheets("Sheet1").Range("D" & i) > 99 Then
film.Worksheets("Sheet1").Range("E" & i).Value = "Medium"
Else
If film.Worksheets("Sheet1").Range("D" & i).Value < 100 Then
film.Worksheets("Sheet1").Range("E" & i).Value = "Short"
Else
film.Worksheets("Sheet1").Range("E" & i).Value = "Long"
End If
End If
Range("A2").Activate
Range(ActiveCell, ActiveCell.End(xlToRight)).Copy
Worksheets(Filmrating).Activate
'ActiveWorkbook.Worksheets(Filmrating).Range("A1").Activate
Selection.PasteSpecial
Next i
Application.ScreenUpdating = True
End Sub
i get the error from the title of the thread and this row is highlighted ,,Worksheets(Filmrating).Activate,,
Do you have any idea how should i fix this?
Thank you and regards,
Ossian