I am building a large Userform and I am going back to edit some of the controls (renaming, resizing, etc). The problem is, after editing, the changes don't stick. I can open another module and then open the form again and the changes will be gone. I can save Excel, close the file, and open it again, and the changes will be gone.
i am using the following code to put data into a worksheet which it does perfectly. once the data is put into the sheet it is saved. what i want to do next is to retain the data in the userform and possibly change one or two entries and put data back into the sheet to save again
Option Explicit Dim ans As Variant Dim MyArray(100, 4) Public MyData As Range, c, d As Range
Private Sub cmbAmend_Click()
Application. ScreenUpdating = False Set c = Range("b4").End(xlUp).Offset(3, 0) ' c selected by Find c.Value = Me.DTPicker1.Value ' write amendments to database c.Offset(1, 0).Value = Me.TextBox1.Value c.Offset(2, 0).Value = Me.TextBox2.Value c.Offset(3, 0).Value = Me.TextBox3.Value c.Offset(12, 0).Value = Me.ComboBox1.Value Set d = Range("b16").End(xlUp).Offset(1, 0)
I am trying to accomplish keeping userform data in the userform after saving & closing the workbook. I am not referring to saving the data in a worksheet. Is this possible?
I'm concatenating data in 5 cells (Author, Year, Title, City, Publisher), one of which is in italics (Title). When using concatenate (or &) the formatting is removed, and I need to be able to retain that formatting.
Example: Col B Aaron, M. (ed) 1999 The Body's Perilous Pleasures. Endinburgh Edinburgh University Press
I have a textbox that displays text from another cell in the workbook. The other text has some sections in bold, but when it displays in the textbox it doesn't show the bold text - The code I'm using at the moment is below.
Private Sub UserForm_Initialize() Dim R As Long ComboBox2.List = Array("QuestionSet1", "QuestionSet2")
I need a solution so that each day I can get a value from a single cell but it appears in a new column each day.
eg, A1 contains a numerical value (based on a formula) Each day there is a new column, say, Monday = B1, Tuesday = C1 etc. On Monday B1 takes the value of A1 and 'freezes' the value in B1 On Tuesday C1 takes the value of A1 and 'freezes' the value in C1, but the value in B1 remains as it was when it was originally frozen.
I have a quantity column on an inventory sheet which automatically updates the available quantity based on sales from a sales sheet. But I need to know the date the quantity reached zero.
That date would always be "today," on the day the quantity = 0, but how do I make the date NOT update to "todays date" on the next day, and the next, etc. It needs to stay as the date that 0 qty was reached.
how do you store formulas so that they stay in the cells when all info is deleted? so i can use the same spreadsheet every week but all i have to do is select all and delete. if i do it now i lose al my formuals.
I can't seem to get the Concatenate function to work in my macro when there is a combination of numbers and text. It works fine is there are no alpha characters. I am using this macro to format all of the data in column "A" to have 5 characters and be text. These values will later be used in formulas and Pivot Tables.
Sub Macro2()
Dim sinlen As String Dim sinformat As Variant Dim lastcell As Variant
I am programming some kind of database in excel and using comboboxes as drop down lists to enter some of the information in the DB. My problem is that when the file is saved, closed and then opened again, all of the comboboxes have lost their selection. I think that using the ControlSource might help but for some reason I can't find the proper syntaxe to make it works. Actually I am getting a Run time error 438: This object doesn't support this property or method.
I have included the relevant portion of my code below. Is the ControlSource property going to solve my problem? If so, what is the syntax I must use? If not, what can I do to make sure that my ComboBoxes are going to keep their selection?
ActiveSheet. OLEObjects.Add(ClassType:="Forms. ComboBox.1", Link:=False, _ DisplayAsIcon:=False, Left:=hori_offset - 220, Top:=vert_offset + 78, _ Width:=180, Height:=24.75).Select With ActiveSheet.OLEObjects("ComboBox1").Object .Font.Size = 14 .Font.Bold = True .Style = fmStyleDropDownList 'Use drop-down list .BoundColumn = 0 'Combo box values are ListIndex values End With With ActiveSheet.Shapes("ComboBox1") .OLEFormat.Object.ControlSource = "Q1" .OLEFormat.Object.ListFillRange = "M1:M8" End With
I need to create a variable that will be TRUE/FALSE based upon whether the user has made changes to a certain range without running a specific macro. Basically, if they change cells in a certain range, the 'Update' macro must be run. I want this variable to be False if the cells have changed without running 'Update' and then when 'Update' runs, it sets the variable back to True.
I've been able to make this work with a Public variable, but if the user closes the workbook, the variable resets to False. Is there a way to create a variable that will be remember even if the workbook closes?
I have a list of values which also has duplicates. I want to remove the duplicates but after comparing it to the dates. Retain the latest date and remove the old dates Eg. there are two duplicates, one has a date of 31st Jan 2013 and the other one has a date of 25 jan 2013. I want to remove the duplicate which has the older date ( 25 Jan 2013) and keep the one which has the latest date.
My data has various dates in column A, which I group into months using the formula "=DATE(YEAR(A2),MONTH(A2),1)" in column B. Then I format column B to show the results in the format mmm-yy. So far so good.
I then use a pivot table to count the number of entries for each month and I have formatted the date column the same way. But every time I refresh the data (which I need to do frequently as data floods in from external sources), the format of the pivot table reverts to dd/mm/yyyy and I have to go and manually reformat it again.
I've checked all the options I can think of, but cannot find any way to keep the format as I have set it. Does anybody know of a way?
I'm using Excel 2003 on Windows 2000 Professional.
I cant seem to figure out how to concatenate data from two cells into one cell and retain trailing zeros. If Cell A1 has ".0000" and cell A2 has ".0005" then I want cell A3 to show: ".0000-.0005".
I get "0-.0005" on my attempts. Alos, how do I make the value an actual number and not a formula?
I have ID numbers that sometimes starts with one or more zeros and when i try to paste a string containing ID numbers that starts with a zero, excel converts it to a number thereby deleting the leading zero(s). Is there any way to force excel to keep the leading zero when i paste from the clipboard?
I have tried setting the format for a column as text using xlSheet.Columns("D").NumberFormat = "text" before pasting to try to force excel to keep the leading zero but the ID# comes out unreadable as "############". I have also tried formatting as "General" and custom formatting the column before pasting but have been unsuccessful thus far. I've seen other programs accomplish pasting numbers with leading zeros but how do you do this?
I am just basically sorting through a huge dataset and grabbing unique codes and storing them in an array for later use. Some of the codes are numeric and some are alphanumeric therefore I am storing them as strings. However, when a code is for example 000578 - once a recall this from the array it has become 578. Is there anyway to preserve the entire code, i.e. make the array recall 000578.
I have an add-in with an attached customised toolbar. If I add a new button to the toolbar, it will be available. However, if I unload the add-in and reload again, every changes to the toolbar buttons and menu items will be lost.
This is an example of what I have done: 1) I add a button to the add-in toolbar. 2) In VB editor, I change the IsAddin property to False so that the addin workbook is visible. 3) Under the Tools->Customized, I attached the toolbar to the add-in workbook. 4) In VB editor, I change the IsAddin property back to True. 5) After I unload and reload the add-in again, the new button is not available on the toolbar.
I'm trying to set the focus back to the field that triggers an AfterUpdate event.
Private Sub myField_AfterUpdate() myfield.SetFocus End Sub
Code above sets the focus to the next field in the taborder instead of keeping the focus on the field (that didn't pass the validation) that triggered the AfterUpdate event.
I was wondering is there a way to use vlookup and then when the particular piece of data is found (using vlookup) to paste it as a value instead of the formula? I have a file that tracks the market value of certain portfolios and i have a source file that i update every month. I dont want the numbers to be overwritten each month, i want to keep a history of the market values each month. Do i need to program something in VBA or can i work something up in the formula bar?
Using xl 2007 - The following code is working fine. except on completion my new sheet does not have the same nice formatting of the Original Sheet.. So I need to Incorporate the formatting of the new sheet to be the same as the Original Sheet.
Sub DumpAutoFilterToNewSheet1() Dim wss As Worksheet Dim wsd As Worksheet Set wss = ActiveSheet If ActiveSheet.FilterMode Then Set wsd = Worksheets.Add wss.AutoFilter.Range.Copy _ Destination:=wsd.Cells(1, 1) Else MsgBox "Nothing is currently Filtered" & vbNewLine _ & "Filter a Column and Try Again." End If End Sub
I use pivot tables extensively in my job. I have several spreadsheets that feed from acess database tables to build pivot tables. Besides the fields imported from Acess, I also create calculated fields. The problem is, for both the calculated fields and the imported fields, the number formatting does not stick. I know how to go to field settings, then to number, and change the customized format. The problem is, once I take that field out of the pivot table and bring another one with a different format (say, bring a field with currency format and take away one field with a percentage format) and then bring the original field back to the privot table, the number format is gone.
This is really annoying since I work with dozens of fields, and it takes time to change the number settings every time I change fields on the pivot table, and the number of decimal places, etc. I stress that I know how to change the number formatting on fields, it's just that it excel does not remember it afterwards.
I thought that maybe the formulas in excel might allow one to include the formating, but I have not been able to find if this is possible, and if so, how to do it. So, for example, the following formula for a calculated field: