I'm working on a Tool, where every change should be saved in a new Version. So if the user changes any number, he should click my selfcreated save-button, which takes todays date in the filename (no problem so far).
I tried to disable the "normal" save-button with:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = True
MsgBox ("saving cancelled!")
End Sub
Unfortunately this code won't allow my own button to save too. Is there any other way? Maybe sth like if "normal" saving is used, then automatically activate a makro (which is also on my button) instead of just saving?
I have an issue with saving the file at the desired location below is the code i have currently used . I have given the destination as "D:New folder". The new file does get saved at location "D:" but not inside the "D:New folder", instead names the file as "New folder".
I am trying to have the user hit a button and save the workbook in a newly created directory. Currently it creates the new workbook and the new directory with the correct names, however the workbook is not in the newly created directory.
I have code that creates a row of controls on an MSForms.Userform at runtime.
I would like the user to be able to save these controls so that they are available the next time he opens the form. The user would be able to add or delete a row of controls and save them AND the values that he has set. This allows great flexibility for each session using the form.
The values aren't a real problem - I've been using the SaveSettings function for the design time controls values. The runtime controls are combobox, textbox, listbox, checkbox.
I don't want to design-time build the controls and just toggle the visible property (not a good solution for my app).
I have a workbook that has twenty data sheets. The user presses a button that copies they're specified sheets to a new workbook and prompts them with the SaveAs Dialog. How do I code it so that if they press the CANCEL button on the SaveAs Dialog it closes the created spreadsheet without saving it?
Suppose in a work book I have a list for data in 5 rows.
1 2 3 4 5
Is there a way to randomize the data with one created button click (like hyperlink button used for linking) so that it may show any random output like 2,1,4,3,5 etc. Next time another click on randomize button creates another set of totaly random order of the 5 data sets.
I have created a button name "Add Power Source" on excel sheet that adds a table and a button(named "Add Row") to the sheet.Whenever the user clicks the "add power source" button a table and a "Add new row " button is created .This "Add new row" button is used to add rows to the table. Now suppose the user has pressed the "add power source" button 5 times,so that there will be five table on sheet and each having a "add new row " button associated with it.When the user wants to add a new row to the table 2 say .How will I come to know in which table the rows are to be added using VBA.
This code appears to do opposite of what I intended i.e., when I click 'Yes' button it closes the file without saving; and when I click 'No' button it closes the file with saving?
Private Sub btnExitNewPipes_Click() If MsgBox("Save the Data?", vbYesNo + vbQuestion, "File Save") = vbYes _ Then ActiveWorkbook.Close SaveChanges = True ActiveWorkbook.Close SaveChanges = False End Sub
I have created a userform and a command button to bring up the user form but when I click on the command button and the user form pops up I am not able to enter any data, the entire page freezes
This is the code
Private Sub CommandButtoncancel_Click() unloadme End Sub Private Sub CommandButtonOK_Click() With Workbooks("RETS results version 2.xlsm")
I have a workbook with macro button to run some vba, if i want the button to disable when the user make copies of the workbook (date created is later than original wb saved time) what codes to add in the VBA?
what i assume is to add the time to a cell when the wb is saved, when the wb opens, it check for that cell if the same with the date created, if different, then disable the macro button.
So i got a few macros on a worksheet and one of them is simply :
Sub Pr_Removefilter() ActiveSheet.ShowAllData End Sub
Ive worked on the excel a couple of times, everything fine. Then it started crashing upon saving (after changes made that had no possible connection to the macro, on another sheet). After a few painfull trials and errors i located the problem to be this macro button. I erased it, created a new one with the EXACT macro and it works. Why?..
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 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 some VBA code that crates a PDF saves it in a direcory gained from Cells in Sheet and i now wanto to email that saved PDF but it keeps coming up with file path not recognised or found.
Code: Sub saveandclose2() Dim MyPath As String Application.DisplayAlerts = False
I have created a pop up calendar using VBA with the help of VBA Tips at www.fontstuff.com/vba and it works very well. However it has the default date of 12 March, In the tutorial that i used there was some code to use todays date if the cell (in which i was going to put a date) is empty. Which is as follows
Private Sub UserForm_Initialize() If IsDate(ActiveCell.Value) Then Calendar1.Value = DateValue(ActiveCell.Value) Else Calendar1.Value = Date End If End Sub
yet when the calendar does pop up, the date remains at 12 March (the calendar in the visual basic editor reflects the date correctly). I've tried to change numerous amounts of properties, without success
I've created a macro which copies the current tab to a new workbook (Book X):
[Code]....
I then manipulate the copied data in Book X. Once this is done I move the manipulated sheet back into original file
[Code] .......
The problem i'm having is I'd like to close the newly created Workbook X file once the macro has run but Workbook X is usually called Book2, Book4, Book7, Book32 etc.
Workbook X will always be the previous file if i use the ALT TAB shortcut.
I am trying to create a function in VBA that will return a range, but I don't want the range to point to cells on a spreadsheet. I want the range to return a vba created range. Is this possible or impossible? Is a variable of type range required to point to cells on a spreadsheet?
I originally posted this in the "Excel New Users forum" - i guess that was an error, but I'm very new (second post) and very new to VBA in general - so please be gentle!!
I've created a macro which opens a workbook, creates and renames a new worksheet, and moves it to the end of the workbook.
I then need to paste into this new worksheet a selection from another workbook.
How would I specify in the code that the selection needs to be pasted into the newly created tab?
I am trying to create a file which will contain several thousand links to files which will not be created for some time. It's purpose is to trend KPI's and budget compliance over time. Is there a way to create these links in Excel 2007 without having to cancel the annoying "Update Valeus" window? Here is an example of that is looking for a file that will be created in 2 weeks.
=IF(AND(ISNUMBER(MATCH(B12,'V:MaintenanceWork ManagementPublicWork Management KPIsSAP SchedulingJobs With Operations In The Past[Jobs with Operations In The Past 11-4-09.xlsx]Plant Section Sort'!$B:$B,0)),(ISNUMBER(MATCH(I12,'V:MaintenanceWork ManagementPublicWork Management KPIsSAP SchedulingJobs With Operations In The Past[Jobs with Operations In The Past 11-4-09.xlsx]Plant Section Sort'!$I:$I,0)))),"Duplicate","New")
I've tried declaring my object variable (TabOrder) as module-level within a Sheet Module and also as local within a Subroutine in the Sheet Module. In both cases, when the debugger steps through the code, the object is destroyed almost as soon as it is created.
I'm attempting to enter a formula into cells on a spreadsheet through a macro.
I want the formula to read:
=if(isblank(G1),"",month(G1))
but because this is being created within a macro it doesn't like the double quotations.
I can get it to display "0" but i want those cells to be NULL. Right now my only idea is to make an IF statement in the code that doesn't insert a formula in those instances, but I'd like to keep them all as formulas for later changes. Anyway around this dilemma?
Example Code (only a piece):
Code:
With Range("F1") .Value = "=if(isblank(G1),,month(G1))" .AutoFill Destination:=Range("F1:F" & lastrow) End With
I'm a novice at Excel and need some help. We have a local area Dollars for Scholars high school chapter auction coming up and I need to sort the information that has been entered into an Excel spreadsheet (there are several hundred contacts). I need this sorted to create labels to send out donation letters. Last year we used ACT, but the chapter board wants to use Excel so everyone can have the info at their fingertips (since everyone doesn't have ACT). The information was entered in column A like the following (in rows not columns):
Name Address 1 Address 2 City, State telephone #
Name Address 1 Address 2 City, State telephone #............
I've created and excel spreadsheet that has code like this in a Module named Print w/ in the workbook: Sub Print_wsPrint() Sheets("Print").PrintOut End Sub
I have saved it as an MS Office Excel add-in.
I added the add-in to my excel environment via Tools, Add ins...and let it copy it to my C:Documents and SettingsjohnApplication DataMicrosoftAddIns directory.
But yet when I create a menu button and assign the Print_wsPrint to a custom menu, it complains and says "The macro Model.xls!Print_wsPrint cannot be found," where Model.xls is the workbook I am in. It's in my add-in, not in the current wb.
How do I get a random name from a list that I have created? The random feature only deals with numbers. I want to be able to push F9 or click on something and have a cell randomly pull a name from the list.