Macro Close A Worksheet Without Saving And Without Confirmation
Dec 17, 2002
I am new to EXCEL and wanted to know if you can have excel startup running a macro and also if you can have a macro close a worksheet without saving and without confirmation. I created the basic macro of what I want to do. I just want it to be able to run unattended. Is this possible with EXCEL?
Using excel 2003, I have a ss that uses filters and sorting. I can get to the data I want but must reopen the workbook if I want to start over and extract different information. I tried installing this VBA:
Sub CloseMe() Application.OnTime Now + TimeValue("00:00:10"), "OpenMe" ThisWorkbook.Close False End Sub
Sub OpenMe() MsgBox "I'm Back!" End Sub
This is my first time at inserting VBA. Usually I just use keystroke macros. I have set my Excel VB Book options to: Option Explicit double clicked the sheet I was using and under general inserted the code, closed Ctrl+Q, saved workbook. When I reopened and tried to use it all I get is “I'm Back!” nothing else happens. One time it actually ran and reopened but it appeared that the workbook was saved before closing because it was still sorted. What I need is it to completely unsorted as it is when I first open it so I can start over.
i m designing a test for a school and want to add a macro that will be assigned to a button at the end of the test i want the macro to close down the the excel program running and not prompt the user to save the workbook is there a vb code that can do this i have tryed a few but they all come back object not found.
I have created a form in a worksheet which I have added questions too and then locked all cells except the ones where I want the answers in.
I have then added a button to the bottom of the sheet called "Print and Save". This work sheet is called "form"
On a second sheet called "database", I have all the titles of the questions running from a -> k and nother else.
What I want to happen is the user input the information on "form" into the boxes available. Once they have completed the questions, I want them to be able to click on "Print and Save" so that firstly the page "form" prints, and then for all of the answers to be saved in "database" below the titles for each question.
I have had a play, but just don't know where to start. Also, once there is a row of questions below the titles, I don't want it to overwrite information already there, it needs to go onto the next empty row available.
Attached is my excel file.
You will see in the code that I have the code for printing.. I just found this on the net and it seems to work fine for me.
I have a userform1 with 12 text boxes with values/text and on this userform there is a cmdbutton to bring up userform2 to change the values/text of the textboxes on the userform1, it changes all the values/text on all the textboxes on userform1, however I want it to save these changes when the 1st userform closes & then re-opens?? How do I do this??
I have created a macro, but running the macro will replace the data that are already in the cells. So what I would like to do is to have a pop-up window come up when clicking the macro button asking if you really would like to proceed
I have a spreadsheet that imports data, manipulates it then deletes 2 of the sheets then saves the file under a different name to the network. Is there any way to save this new worksheet without it storing the macros - so when the user open it, only the data is there and they get no prompt to enable macros?
I need to know the command to close a workbook. I have used the information found here: http://www.ozgrid.com/VBA/userform-close.htm to disable closing the workbook via the upper right "X", but I need a button that, when clicked, simply closes the workbook instead.
The idea is that a button on the worksheet 'Sample Info & Results' runs the macro which copies the worksheet to a new file with the name specified in the cell B3 and saves it as a csv format with ";" as the separator. For the most part it is working with the exception that the export stops at row 6 for some reason I dont understand. The code is not mine (credit to T.Thielmans on stackoverflow). code for 1) referencing a folder location within the original file to use as a standard location to save the csv file and/or 2) removing hidden columns.
Code: Public Sub ExportToCSVFile(FName As String, Sep As String, SelectionOnly As Boolean, AppendData As Boolean) Dim WholeLine As String
I have a workbook which utilizes 2 worksheets to fill a third. I would like a macro to be able to save JUST that worksheet, and not the other two. I thought there was a checkbox allowing you to "save selected" only, but I'm either dreaming, or it was in a previous version of Excel (I know use Excel 2000).
I have a batch script which runs the following line to open my excel sheet:
when this sheet opens it automatically refreshes from a csv file.
The problem is that I want this sheet to open, refresh and close. To close Excel I have been using the taskkill command in my batch script, but I have found that using this method doesn't update the sheet properly - the sheet only updates properly if I close Excel in the correct way, but this means manual input and I want this to be automatic.