Having an issue with the the Sub not being defined. Can't find the issue.

finAnalysis

New Member
Joined
Oct 13, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
VBA Code:
Sub Deals_Approved()

Dim Deals_Approved As Variant
Dim ws As Worksheet
Dim wb As Workbook
    Sheets("Monthly P&L").Select
    ActiveSheet.Range("A2").Select
    Selection.Copy
   
MsgBox ("Select Deal Sheet from Desktop")
'This will direct the user to select the Deal log that way the folder can be moved and this doesn't break'

Deals_Approved = Application.GetOpenFilename(FileFilter:="Excel Files,*.xl*;*.xm*")
If Deals_Approved <> False Then
    Workbooks.Open Filename:=Deal_Approved
    End If
   
    Sheets("Approved").Select
    'If headers change and tab names change this argument and the next one will break'
   
    Range("A1").End(xlDown).Select
    ActiveCell.Offset(1).Select
    'Moves down one cell for the next time the macro is run'
   
    PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    ActiveWorkbook.Close savechanges:=True
    ThisWorkbook.Activate
    Sheets("FinancialModel").Activate
    ActiveSheet.Range("A1").Select
   
MsgBox ("Deal Sheet has been updated!")
End Sub
 
Last edited by a moderator:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
This line is the problem PasteSpecial Paste:=xlPasteValuesPasteSpecial is a method of Range, not a standalone.
Try
VBA Code:
Sub Deals_Approved()

Dim Deals_Approved As Variant
Dim ws As Worksheet
Dim wb As Workbook
    Sheets("Monthly P&L").Select
    ActiveSheet.Range("A2").Select
    Selection.Copy
   
MsgBox ("Select Deal Sheet from Desktop")
'This will direct the user to select the Deal log that way the folder can be moved and this doesn't break'

Deals_Approved = Application.GetOpenFilename(FileFilter:="Excel Files,*.xl*;*.xm*")
If Deals_Approved <> False Then
    Workbooks.Open Filename:=Deals_Approved
    End If
   
    Sheets("Approved").Select
    'If headers change and tab names change this argument and the next one will break'
   
    Range("A1").End(xlDown).Offset(1).PasteSpecial xlPasteValues
        Application.CutCopyMode = False
    ActiveWorkbook.Close savechanges:=True
    ThisWorkbook.Activate
    Sheets("FinancialModel").Activate
    ActiveSheet.Range("A1").Select
   
MsgBox ("Deal Sheet has been updated!")
End Sub
 
Upvote 0
Solution
This line is the problem PasteSpecial Paste:=xlPasteValuesPasteSpecial is a method of Range, not a standalone.
Try
VBA Code:
Sub Deals_Approved()

Dim Deals_Approved As Variant
Dim ws As Worksheet
Dim wb As Workbook
    Sheets("Monthly P&L").Select
    ActiveSheet.Range("A2").Select
    Selection.Copy
  
MsgBox ("Select Deal Sheet from Desktop")
'This will direct the user to select the Deal log that way the folder can be moved and this doesn't break'

Deals_Approved = Application.GetOpenFilename(FileFilter:="Excel Files,*.xl*;*.xm*")
If Deals_Approved <> False Then
    Workbooks.Open Filename:=Deals_Approved
    End If
  
    Sheets("Approved").Select
    'If headers change and tab names change this argument and the next one will break'
  
    Range("A1").End(xlDown).Offset(1).PasteSpecial xlPasteValues
        Application.CutCopyMode = False
    ActiveWorkbook.Close savechanges:=True
    ThisWorkbook.Activate
    Sheets("FinancialModel").Activate
    ActiveSheet.Range("A1").Select
  
MsgBox ("Deal Sheet has been updated!")
End Sub
Thank you! I knew it was something easy I just kept overlooking!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top