Macro no longer working after downgrade from office 2015 to 2010

BBG Metalmeccanica 1 Reputation point
2021-10-15T13:49:02.093+00:00

Good morning
I wanted to show you this macro that I used and it worked fine until I installed office 2010. First on the pc there was office 2016 installed. I also posted the code, the macro copies a sheet from an excel file and pastes it into another file excel and appends the copy to a sheet.
I can't understand why it doesn't work anymore. If anybody please have any ideas and want to help me.
Greetings and thanks

Sub AccodaFogliKitamura()

  Dim wbk1 As Workbook
  Dim wbk2 As Workbook
  Dim Sheet1 As Worksheet
  Dim Sheet2 As Worksheet
  Dim lriga, lriga2 As Long
  Dim rng1, rng2 As Range


  Application.ScreenUpdating = False


   Set wbk1 = Workbooks.Open("C:\Users\fabri\Documents\BBG\BBG-PROGRAMMAZIONE-LAVORO.xlsm")


   Set Sheet1 = wbk1.Sheets("Kitamura")

   With Sheet1
    lriga = .Range("A" & .Rows.Count).End(xlUp).Row
   End With

   Set wbk2 = Workbooks.Open("C:\Users\fabri\Documents\BBG\CERCA-DATA-LEVIEN-EURO.xlsm")


   Set Sheet2 = wbk2.Sheets("FogliAccodati")

   With Sheet2
    lriga2 = .Range("A" & .Rows.Count).End(xlUp).Row
   End With



   Sheet1.Range("A2 : K" & lriga).Copy _
   Destination:=Sheet2.Range("A" & lriga2)

   Application.ScreenUpdating = True
  End Sub
Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Developer technologies | Visual Basic for Applications
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.