0

I am trying to import a list of names from a closed workbook to another workbook that will be the general count of the names but I am getting all types of errors can someone help me?

Sub febrero()
Sheet2.Activate
'poniendo nombres a cada workbook
Dim wb1 As Workbook, wb2 As Workbook
Dim count1 As Integer

Application.ScreenUpdating = False

'definiendo wb1 y wb2

Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("C:\Users\alede\OneDrive\Escritorio\hey\New folder\hey\datos m2017.xlsx")
' conteo


'copiando nombres de apartamentos

wb1.Sheets("Reporte").Range(Range("A4").End(xlDown)).Value = wb2.Sheets("Cuadro General").Range(Range("B4").End(xlDown)).Value







End Sub
Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
  • 2
    *"All types of errors*" does not help us at all. Please explain the **specific** error you are getting and on what line. – urdearboy May 18 '20 at 20:50
  • 2
    The problem is that `Range("A4").End(xlDown)` and `Range("B4").End(xlDown)` are not qualified with the workbook/worksheet they are in/on. – BigBen May 18 '20 at 20:53
  • You probably want to set `ScreenUpdating` back to `True` before you exit the sub – Darrell H May 18 '20 at 21:01
  • Let's say that `Sheet2.Activate` and `Dim count1 As Integer` are not needed. What are you trying to copy? The last cell in the source sheet below the last cell in the target sheet or the range from A4 to the last cell below the last cell, or the range from A4 to the last cell to the range from B4 to the last cell, or...? Is the workbook wb2 opening i.e. is the path correct? – VBasic2008 May 18 '20 at 21:26

0 Answers0