I'm trying to copy the values of a range of cells and then pasting it on a different workbook using VBA. However, the code only paste the first copied cell, leaving the rest of the range in blank. I couldn't identify my mistake.
This is the code:
Sub Data()
Dim wbk As Workbook`
Dim wks As Worksheet`
carp = ThisWorkbook.Path & "\Bases de datos\"
a = "Cuadros_de_salida_IMAE.xls"
Application.EnableEvents = False
Set wbk = Workbooks.Open(carp & a)
Set wks = wbk.Worksheets("Activ")
Application.EnableEvents = True
wks.Rows.Hidden = False
b = "D"
c0 = 9
c1 = 25
E = "IMAE"
f0 = "G"
f1 = "W"
g = 6
iniRow = c0
finRow = c1
wks.Range(b & iniRow & ":" & b & finRow).End(xlToRight).Copy
ThisWorkbook.Worksheets(E).Range(f0 & g).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, Transpose:=True
Windows(a).Activate
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True
Thanks. I really appreciate some help.