Calling another section of Macro

gruntingmonkey

Active Member
Joined
Mar 6, 2008
Messages
427
Office Version
  1. 365
Platform
  1. Windows
Hello,

Am trying to to get to the end of a macro by using the call function but its not working, does anyone have any ideas


Sub Save_File1()
Dim File1 As String
Dim File1dest As String

File1 = Worksheets("utilities").Cells(14, 13).Value
File1dest = Worksheets("utilities").Cells(14, 14).Value
Worksheets("utilities").Select
Worksheets("utilities").Activate

If Cells(14, 5).Value = "Y" Then
Workbooks.Open Filename:=(File1)
ActiveWorkbook.SaveAs Filename:=(File1dest)
ActiveWorkbook.Close
Else
If Cells(14, 5).Value = "N" And Cells(14, 4).Value = "Y" Then
MsgBox "Report needs running before saving"
Else
If Cells(14, 5).Value = "N" And Cells(14, 4).Value = "N" Then
MsgBox "This file is in no way needed today move on to the next file buster!"
'Call line2000
End If
End If
End If

MsgBox "Update Complete"

'line 2000

End Sub



I just want to miss out the last message box as its pointless. Have tried as above Call line2000 and then put line2000 in at the bottom but it says I dont have a function defined.

Hope this makes sense.
Jess
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Rich (BB code):
Sub Save_File1()
Dim File1 As String
Dim File1dest As String

File1 = Worksheets("utilities").Cells(14, 13).Value
File1dest = Worksheets("utilities").Cells(14, 14).Value
Worksheets("utilities").Select
Worksheets("utilities").Activate

If Cells(14, 5).Value = "Y" Then
    Workbooks.Open Filename:=(File1)
    ActiveWorkbook.SaveAs Filename:=(File1dest)
    ActiveWorkbook.Close
Else
    If Cells(14, 5).Value = "N" And Cells(14, 4).Value = "Y" Then
        MsgBox "Report needs running before saving"
    Else
        If Cells(14, 5).Value = "N" And Cells(14, 4).Value = "N" Then
            MsgBox "This file is in no way needed today move on to the next file buster!"
            Exit Sub
        End If
    End If
End If
MsgBox "Update Complete"
End Sub
 
Upvote 0

gruntingmonkey

Active Member
Joined
Mar 6, 2008
Messages
427
Office Version
  1. 365
Platform
  1. Windows
My love for you is deep.....

It works and now I shall have a cup of tea to celebrate!

Jess
 
Upvote 0

Forum statistics

Threads
1,195,670
Messages
6,011,074
Members
441,581
Latest member
rp4717

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
Top