Excelworld
New Member
- Joined
- Nov 10, 2011
- Messages
- 33
Hi,
I'm getting the above error when running the VB code - basically I want the code to check which active workbook is open before it pastes the data in. Both workbooks are set up the same but with different names and the code runs from a separate workbook - I'm using excel 2010
any ideas?
I'm getting the above error when running the VB code - basically I want the code to check which active workbook is open before it pastes the data in. Both workbooks are set up the same but with different names and the code runs from a separate workbook - I'm using excel 2010
Code:
Sub sheetup()
'
' Copies the details of the candidate onto the main management tracker
'
Range("AC71:AJ71").Select
Selection.Copy
Windows("work1.xls").Activate
ActiveWorkbook.Sheets("CANDIDATES").Activate
On Error Resume Next
Windows("work2.xls").Activate
ActiveWorkbook.Sheets("CANDIDATES").Activate
Range("C" & Cells.Rows.Count).End(xlUp).Offset(1, 0).Select
Dim LastRow As Long
LastRow = Sheets("Candidates").Range("C" & Cells.Rows.Count).End(xlUp).Offset(1).Row
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C" & Cells.Rows.Count).End(xlUp).Offset(1, 0).Select
End Sub
any ideas?