I have a question specific to some code. I get an error on the line which reads ActiveCell.PasteSpecial, but I don't know how to correct it. To summarize what I'm trying to do: this macro opens a file, copies a range, and pastes that range - transposed - into my active worksheet.
Any recommendations for changing this would really be helpful. Thanks
Code
Sub importMMD()
Dim Row As Integer
Dim totalrows As Integer
totalrows = ActiveSheet.UsedRange.Rows.Count
Range("a1").Select
'loop from 1 to total rows to import data
'opens (Row,1).xls and copies value into (Row,2) only if (Row,2) is blank
For Row = 1 To totalrows Step 1
If Cells(Row, 2) = "" Then
Workbooks.Open Filename:=(Cells(Row, 1).Value)
Range("C5,C6,C7,C8,C9,C11,C14,C19,C24").Select
Range("C34").Activate
Selection.Copy
ActiveWorkbook.Close
Cells(Row, 2).Select
ActiveCell.PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End If
Selection.Offset(1, 0).Select
Next Row
End Sub
Display More