I have a combobox where one of the Values is 12/6 when it pastes to the Sheet, it shows up as a date. How do I set the combobox to always paste as text?
I have a combobox where one of the Values is 12/6 when it pastes to the Sheet, it shows up as a date. How do I set the combobox to always paste as text?
-Dan
www.ksvp.org
Do you have the combobox linked to a cell, or do you have VBA enter the value into the sheet?
If you have it linked to the cell, you can simply format the cell as text.
Yes, the combobox is sourced by a series of cells A1:A100
I will give that a try. Thank you
The combobox is sourced by different ranges of cells based on an optionbox in the user form. The Userform Initialize starts the combobox at "", then if the option is selected, the cbo contains the selected range.
I formatted the source cells to text, but it did not work. Im still getting 6-Dec instead of 12/6
I still need an answer for this one. I asked yesterday, but the answer I got doesnt work.
Thank you
Here is what Im talking about. I currently have one textbox that I format so it is 9 digits long. This allows it to have a zero show up in front of a 8 digit number.
txtPO.Value = Format(txtPO.Value, "0########")
Now I just need to figure out how to word this so 12/6 shows up as 12/6 instead of Dec 6.
Hello Dan,
I feel I can help you with this problem, but I am a little confused. In the first post you were talking about a combo box and the last post of this thread you are talking about a text box.
First question is, do you need both to format 12/6 as text?
Second question is, are the controls on the worksheet?
Third question is, what types of controls are you using? (Forms, Control Toolbox, or both)
Sincerely,
Leith Ross
The textbox mentioned is how I formatted a cell on a previous userform. I was just using it as an example of what Im looking for. Something to put in the code that will make the output show as text rather than converting it to a date.Originally Posted by Leith Ross
cbo.PN1 - cbo.PN45 are the comboboxes on this userform. They are sourced, based on 1 of 5 optionboxes
Sheet3 (optBP)A3:A99, (optAC)E3:E99, (optGM)I3:I99....
those cells contain a variety of part numbers. Some contain both letters and numbers, some contain only numbers, and then there are the problem ones like 8/6, 10/6, 11/6, 12/6, 01016, 01125...
The problem is that the user form pastes the results in a column that contains a date at the top, and a variety of these part numbers, so formatting the pasted cells doesnt help. I tried formatting the source cells with no luck either. References to the comboboxes include the following:
In the code of the UserForm
The Userform Initialize Calls a process I named clear page
The initialize sets all the options to False, but I needed to clear all the cbo and txt boxes in case the user switches options while the form is open
(without setting the options to false)
Clear page contains (Sheet3!A100 is an empty cell) Now that I look at this again, I probably dont need the "With" part of this.
Please Login or Register to view this content.
This part assigns the Value to the text boxes associated with the combo box
Please Login or Register to view this content.
Here is the code that sets the source of cobPN1 when optAC is True
Here is the code that pastes the data from the UserForm to the worksheet when command button 1 is clickedPlease Login or Register to view this content.
Here is code that pastes to a different worksheet when command button 2 is clickedPlease Login or Register to view this content.
Im afraid I may be making things more complicated than they need to be but I am still learning, and I enjoy learning.Please Login or Register to view this content.
This UserForm contains textboxes, optionboxes in a frame, commandbuttons, and comboboxes. File size is 1.13MB It would most likely be much shorter, but I learn as I go, so some of the early code might not be as sophisticated as the code I wrote towards the end. This is a project Ive been working on for some time, but I am very happy as the original which did not use VBA was 6MB.
I hope this is enough information.
The simple answer for your questions are:
I only need the combobox to ouput text to the worksheet via ActiveCell.Offset(down, 1) = Controls("cboPN" & nxpt).Value
The controls are on the UserForm
Im afraid I dont know what a Control Toolbox is, other than the Toolbox I use to add comboboxes and textboxes to the UserForm
The purpose of this UserForm is to input part numbers and quantities from 1 of 5 customers and output the part#, qty, qty/cs, weight/cs, #of cases, total weight of the parts, case total and weight total of all the parts, and some textbox fields like PO#, Carrier, Pro#, Ship Date
I do the shipping in this warehouse, and this greatly reduces my workload, giving me more time to learn Excel.
The second output goes to the assembly department telling them how many cases and how many per case they need to assemble.
Last edited by iturnrocks; 02-13-2007 at 02:03 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks