New to VBA...want to save as with values

jen_maser

New Member
Joined
Jan 15, 2015
Messages
1
Hello - First time poster here and relatively new to VBA/macros! I have an excel worksheet that I have set up for users to update at various times throughout the day. This file is linked to another and auto-refreshes data every time it is opened. After the user updates this template file, I want them to be able to click a button in the sheet so that the file is saved as a new copy with a file name based on fields in the worksheet. I also want the data connection to break on this new saved as file and display the values. I've searched high and low, think this can be done...but having no luck. Any help/direction would be greatly appreciated! Thanks! Jen
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
For the save as thing:
Code:
Dim cell1 As String
Dim cell2 As String
Set cell1 = ActiveSheet.Cells(1, 1)
Set cell2 = ActiveSheet.Cells(2, 1)
ActiveWorkbook.SaveCopyAs "C:\TEMP\" & cell1 & cell2 & ".XLS"
For the connection breaker, you could have your workbook check the workbook name in the Workbook_Open sub. If it isn't "xxxxx" then end program, else continue running program.

or a simple prompt at the beginning of the code to ask you to continue or not. i use this a lot

Code:
    Dim ans As Variant
    ans = MsgBox("Continue running code?", vbOKCancel)
    If ans <> vbOK Then
        End
    End If
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,902
Messages
6,122,161
Members
449,069
Latest member
msilva74

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