gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,340
- Office Version
- 365
- Platform
- Windows
This code is giving me problems at line: ActiveWorkbook.Sheets("PP Import").Range("A11").Select
Run-time error '1004':
Select method of Range class failed
could it be that the workbook being opened is an xlsm? I have no clue why its not working any longer.
Thanks for the help.
Run-time error '1004':
Select method of Range class failed
Code:
Sub MoveReultsToTraker()
Dim sourceBook As Workbook
Dim targetBook As Variant
Dim sourceSheet As Worksheet
Dim targetSheet As Worksheet
Set sourceBook = ThisWorkbook
Set sourceSheet = sourceBook.Sheets("Results")
sourceSheet.Range("Results").Copy
targetBook = Application.GetOpenFilename("Excel files (*.xls*), *.xls*")
If targetBook <> False Then
Workbooks.Open (targetBook)
Set targetBook = ActiveWorkbook
' If Not Evaluate("isref(PP Import!a1)") Then
' MsgBox "The Selected Workbook does not contain a PP Import tab, check to validate the tab is named correctly or select a different Workbook"
' Exit Sub
' Else
ActiveWorkbook.Sheets("PP Import").Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.Sheets("PP Import").Range("C4").Value = Now()
ActiveWorkbook.Sheets("PP Import").Range("C5").FormulaR1C1 = "=MAX(R[11]C[46]:R[1000]C[46])"
ActiveWorkbook.Sheets("PP Import").Range("C5").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Else
End If
End Sub
could it be that the workbook being opened is an xlsm? I have no clue why its not working any longer.
Thanks for the help.