private sub to save an excel sheet as separate csv

VectorW2

New Member
Joined
Sep 11, 2013
Messages
36
Office Version
  1. 365
  2. 2010
I have a private sub that calls a macro (works):

Case "Save":
Call SaveAsCSV

However, I would prefer to not have the "SaveAsCSV" be a public macro and just add it to the private sub

The public "SaveAsCSV" macro:

Sub SaveAsCSV()

'

' SaveAsCSV Macro

'



'

Sheets("Gama Uploadable").Select

ActiveWorkbook.SaveAs Filename:= _

"C:\My Documents\Upload Files (2022)\" & Range("GamaFileName").Value & ".csv", _

FileFormat:=xlCSVUTF8, CreateBackup:=False



End Sub

The public sub also renames the sheet inquisition a unique name based on the value of a cell. That cell has a formula in it.

If you can help me, I would greatly appreciate it.

Thank you in advance.
 

Attachments

  • Public Sub.jpg
    Public Sub.jpg
    47.4 KB · Views: 8
  • Private Sub.jpg
    Private Sub.jpg
    190.8 KB · Views: 8
No that allows you to run a private macro.
Fluff, thank you! I figured out my errors. I needed rename the sheet from a location on the private macro sheet. Something with the way I was trying to save too, but it all works now as a private sub.

Thank you.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,426
Members
448,961
Latest member
nzskater

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