In my Excel VBA user form, there are multiple instances of the MS DTPicker control, which feed multiple text boxes. These in turn are linked to named cells on an worksheet. Note at this stage please that dates will not always be required, hence the text boxes. Only the button on the DTP controls are visible, alongside the related textbox.
My problem is that the values in the cells are in US date format and I need them to be recognised in the UK date format. The dates therein must be formatted as dates (ie not as text), as they are used throughout other worksheets for calculations. In the sample below, DTPickerDateOfIncorporation is the named cell (the control source). I know from Roy's responses to other questions on the DTPicker that he doesn't use it - is there a better alternative?
I am sure this may have been asked before ... but couldnt find it on a search
I have a number of userforms in an excel database, all with add, edit search capabilities.
Several of the textbox's have a time format, when I enter the time it is shown in hh:mm format, it is stored on the spreadsheet in the same format. but if I use the search function to recall a record and display it on the userform, to allow ammendments the time is always shown as a decimal. Can I set it to display the time as entered.
An example of some coding for a text box is shown below
Private Sub TxForTime_AfterUpdate() TxForTime.Value = Format(TxForTime.Value, "hh:mm") End Sub
I have a calendar userform that enters a date into a userform textbox in the format mm/dd/yy.
I am in the UK, so default date format is dd/mm/yyyy but i need it as above - mm/dd/yy
So, when I get a MsgBox to repeat Textbox1.Value (the date from the calendar object, formatted mm/dd/yy) and repeat it in format dddd mmmm dd yyyy, it reads the value not as I want it, mm/dd/yy, but as the usual dd/mm/yyyy - so instead of reading 08/01/12 as Wednesday August 01 2012 it is giving me Sunday January 08 2012 - even though in the cells on the worksheet that are populated from the textbox, the date reads correctly, so 08/01/2012 is indeed 1st August 2012 not January 8th 2012...
So it's the MsgBOx function reading the textbox in the userform wrong, and formatting makes no difference...
Can I fix this without changing my regional settings? Is there a way to set the region in vba then unset when leaving the program? I don't want to have to change regional, and anyway, the program will be used by others who won't know / want to do that.
I've done lots of looking on the forum, and the helpfiles, but just cant seem to format my text box properly! Its a form where the user inputs to the text box. I want to control thatway where they enter numbers e.g 05052008 and it gets converted to 05/05/2008 or 05-05-2008. I've tried a range of things, but am really stumped!
I have a userfrom with 2 textboxes used for entering dates. would like to either force the user to enter the date as xx/xx/xxxx or have a calendar feature where they can select a date. I checked my 'additional controls' in my toolbox but do not see a calendar option.
One of my userform text boxes is for the input of a date. this date is being exported to a defined cell in excel, but in a US format, mm/dd/yyyy. i need this to be exported into excel in UK/Aussie format dd/mm/yyyy as our accounting software is getting confused (i am also).
Private Sub TextBox3_Change() Range("C7").Value = TextBox3.Value End Sub
I having problem to determine the format value of dates that needs to be inserted in a Userform.
I have the following format in my userform for my Textbox:
When I select the calendar in my userform that is set as follows:
And select the first day of the month, it will always add the format as 05/01/2014 but if I select today’s date as example it will add it in the right format: 2014/05/26
I have included a sample to demonstrate the function of the calendar as I have declared it public as d in a module, therefore making the population of my userforms textbox easier to add information on dates.
If you add 2014/05/01 - 2014/05/26 and 2014/05/06 you will see where the system is having problem with the month and dates I guess the system confuses the two?
I'm having trouble getting my random number generator functions to use my variables that are defined by text box inputs. I can mouse over the variables in the code and they have the correct values, with the excpetion of where they are listed in the functions. I'm sure I'm missing something simple, thanks in advance for any help!
Private Sub cmdPopulate_Click() StdDev = txtStdDev.Value RandomNum = txtRandomNum.Value Mean = txtMean.Value lambda = txtLambda.Value OriginCell = txtOriginCell.Value If cmbDistributions.Value = "Normal" Then .................
From the sample file, I am using the data on (start) worksheet. (Sort and format sheet) . This one is way over my head. After new data is added to the sheet via another UserForm, I want to sort the list by name and have alternating backgrounds based on grouped unique names.
I have a worksheet on which users will enter data one row at a time, in columns A-K. When the user starts to enter data in a new row #, that is, when they make any column in the next, unused row have non-blank value, I'd like the sheet to update the borders of the row for columns A-K. I want the Range from A1 to K# to have full borders, so that the whole data set is outlined and easier to read.
For a bonus, I'd like the formulas from the previous H, I, and J cells copied down into H#, I#, and J#, adjusted appropriately for their reference changes.
Normally, I would work around the edges of such a VB problem by recording the actions manually and then modifying that code as I learned more. But I'm not sure if what I've done is the right way to start that process. I think that if I use the CurrentRegion property, and the Worksheet_Change event, I'll be well on my way.
Cell b6 has been formatted to a percentage with 2 decimal places. Using the formula: ="todays percentage is "&B6&", thank you.". The value returned is: todays percentage is 0.78125 thank you. My question is can the returned value from cell b6 be formatted to a percentage or at least be formatted to 2 decimal places? I hope i posted this correctly i am a first timer.
When I remove "Release date:" from "Release date:24 December 2008," excel will automatically change the text to "24-Dec-08." Yes, I did try to format the column to "text" before using find and replace.
This wouldn't be a problem, except that half the dates are in Dutch, so only half the dates are changed, which means that I can't make all date formats in a column uniform.
I am pasting a large amount of data from a sql server query into excel. There is multiple tables output in each query. Some of the data is date/time and excel is formatting all of these cells to time. The date/time cells to not neatly line up in any row or column, so I cannot just format any give column or row. I need a macro that will find all of the cells that are formatted as time and change them to a date format.
The code below is for a macro that allows the user to create a list of contacts. The column containing the names of these contacts are then referenced by a userform (code not present) by way of a Named Range. I want to update the named range whenever the user adds another contact so this new contact shows up in the user form.
I am currently referencing the range containing the names using R1C1 style, but I cannot get the variable aspect to work correctly.
I need a mar that I want to attach to a button that would:Add a new comment with the date/time added to the username [format XYZ 22/10/09 14:48] and then I type the comment text, and/or Append a new comment to the existing comment, in the same format as for 1.
I want to create a macro that when executed changes the name of "File1" to "File1 - Edited 8-9-2012". With the date being today's date (variable). This file is going to be emailed to someone who will then execute this macro.
Is there a way to prompt the Save As window with the updated file name so the user can save the file where ever he/she wants?
In one cell the user has to fill in a date, example 20.3.2008 and then in another cell he/she has to choose a month from a list (january-december). I need a macro that checks that the month stated in the date cell is the same as the month selected in the other list cell.
I have a formula in my spreadsheet that shows dates for servicing of products. Column F show's Date Last Serviced and the adjacent column (G) then shows Date Next Service. When there is nothing on the F column's cell then the date that appears on my spreadsheet is 31/12/00. It looks messy and I would rather have a formula to make it so that if the F column is blank, then the adjacent cell in G column should stay blank also.
To automatically calculate the next service due date, I have variants of this formula that creates the dates in G column:
I have a table of data (total 142 rows). Column contains dates, in the format dd-mmm-yyyy.
I tried to filter using DATE FILTERS->EQUALS and in the custom filter window, I chose EQUALS then picked a date from the date picker icon. The date I picked was 5/4/2009 (this is May 4, 2009, formatted automaticall by excel as m/d/yyyy).
When I clicked OK, nothing showed up despite the fact that there are 6 occurences of May 4, 2009 (formatted as dd-mmm-yyyy in the data table)
So my questions are:
1. Is this due to the formatting?
2. Is there a way to change the date format supplied by the date picker?
I have userform with date pickers and have text boxes overlaid on these, when I select todays date from the date picker it does not display the current date in the text box (I have 8 date pickers on the userform). If I select another date then reselect the current date it works. It has occasionally worked but why.
Below is the code for populating the text box from the Date Picker.
Private Sub DTPicker1_Change() TextBox1.Value = DTPicker1.Value End Sub
The initialize userform code uses the following to format and set the textbox