Hi,

In the following code when I am trying to execute, I am encountering the "Runtime error 91: Object variable or With block variable not set"

The code what it does is, it transfers data from Input sheet to Import Sheet (while matching B85 onwards in Input sheet with column 6 in Import sheet).

Any help is appreciated highly.

Sub Transfer80CEntriesto_IMPORT_CONSOLIDATION()
Application.ScreenUpdating = False
Application.FindFormat.Clear          'yes
Application.ReplaceFormat.Clear       'yes

   Dim ws           As Worksheet
   Dim ws1          As Worksheet
   Dim rng          As Range
   Dim Cel          As Range
   Dim CodeRow      As Long
   Dim CodeCol      As Long
   Dim LR1          As Long
 
    Set ws = Sheets("IMPORT")
    Set ws1 = Sheets("INPUT")
        With ws
                CodeRow = .Columns(2).Find(ws1.Range("C80").Value, , xlValues, xlWhole, xlByRows, xlNext, False).Row
                With ws1
                    LR1 = .Range("B" & .Rows.Count).End(xlUp).Row
                    Set rng = .Range("B85:B" & LR1) 'IMPORT from which cell that has to be transferred to IMPORTsheet
                        For Each Cel In rng
                            CodeCol = ws.Rows(6).Find(Cel.Value, Lookat:=xlWhole).Column 'Find column B particulars in INPUT Sheet in IMPORT Consoilidation sheet in row 6
                            ws.Cells(CodeRow, CodeCol).Value = Cel.Offset(0, 1).Value
                        Next Cel
                End With
        End With

MsgBox "Submitted Savings for the employee" & Sheets("INPUT").Range("C82").Value, vbInformation, "Success"

Application.GoTo Reference:=Sheets("INPUT").Range("C80"), SCROLL:=True
Sheets("INPUT").Range("C80").Select
ActiveWindow.SmallScroll Down:=-1
ActiveWindow.SmallScroll ToRight:=-2

Application.FindFormat.Clear          'yes
Application.ReplaceFormat.Clear       'yes
Application.ScreenUpdating = True

End Sub