victorel21
New Member
- Joined
- Jul 8, 2021
- Messages
- 25
- Office Version
- 365
- Platform
- Windows
I have this code and i am getting an error 91 on the find line.
Every variable has been correctly defined in another module, this worked just find two days ago, now all of them are giving me problems,
Any ideas?
Appreciate the help.
Sub todatabase2()
Sheets("Form").Activate
ID = Range("F1")
GR = Range("A3")
Departamento = Range("C3")
Semana = Range("D3")
Comentarios = Range("B25")
Sheets("Datalist").Activate
Month = Cells(Range("E:E").Find(Semana, Lookat:=xlWhole).Row, 6)
With Sheets("Employee_List")
Set RngCol = .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
End With
Sheets("Employee_List").Activate
LastRow = RngCol.Rows.Count
Range("A2:G" & LastRow + 1).Copy
Sheets("Historico").Activate
last_line = Range("F" & Rows.Count).End(xlUp).Row + 1
Sheets("Historico").Range("F" & last_line).PasteSpecial Paste:=xlPasteValues
Do While Cells(last_line, 6) <> ""
If Sheets("Historico").Range("F" & last_line) <> "" Then
Sheets("Historico").Range("A" & last_line) = ID
Sheets("Historico").Range("B" & last_line) = GR
Sheets("Historico").Range("C" & last_line) = Departamento
Sheets("Historico").Range("D" & last_line) = Semana
Sheets("Historico").Range("M" & last_line) = Comentarios
Sheets("Historico").Range("E" & last_line) = Month
End If
last_line = last_line + 1
Loop
ThisWorkbook.Worksheets("Historico").Cells.EntireColumn.AutoFit
End Sub
Every variable has been correctly defined in another module, this worked just find two days ago, now all of them are giving me problems,
Any ideas?
Appreciate the help.
Sub todatabase2()
Sheets("Form").Activate
ID = Range("F1")
GR = Range("A3")
Departamento = Range("C3")
Semana = Range("D3")
Comentarios = Range("B25")
Sheets("Datalist").Activate
Month = Cells(Range("E:E").Find(Semana, Lookat:=xlWhole).Row, 6)
With Sheets("Employee_List")
Set RngCol = .Range("A2", .Cells(Rows.Count, 1).End(xlUp))
End With
Sheets("Employee_List").Activate
LastRow = RngCol.Rows.Count
Range("A2:G" & LastRow + 1).Copy
Sheets("Historico").Activate
last_line = Range("F" & Rows.Count).End(xlUp).Row + 1
Sheets("Historico").Range("F" & last_line).PasteSpecial Paste:=xlPasteValues
Do While Cells(last_line, 6) <> ""
If Sheets("Historico").Range("F" & last_line) <> "" Then
Sheets("Historico").Range("A" & last_line) = ID
Sheets("Historico").Range("B" & last_line) = GR
Sheets("Historico").Range("C" & last_line) = Departamento
Sheets("Historico").Range("D" & last_line) = Semana
Sheets("Historico").Range("M" & last_line) = Comentarios
Sheets("Historico").Range("E" & last_line) = Month
End If
last_line = last_line + 1
Loop
ThisWorkbook.Worksheets("Historico").Cells.EntireColumn.AutoFit
End Sub