Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a work hours spread sheet that has combo boxes for
start and end times within certain days. I have the combo boxes linked to the cell behind it and populated with hours of the day. The times show up fine when selected, such as 6:00; when I print the sheet or use print preview, the value in the combo box then displays 0.25 (like a quarter of a day). I reselect the box and can repopulate 6:00. It does the same thing for dates too. Is there code in VB that I can write that will allow these values to be printed as times, and not as decimals? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
EJC
It sounds like your using a combobox from the Control Toolbox (as opposed to the Forms toolbar). It also sounds like you have elected to not print the combobox. If all that is true, then it is the cell that is underneath that is printing, not the value in the combobox. You should be able to format that cell to look the same as the combobox. To check if you are printing the combobox, go into design mode, right click on the cb and choose Format control. The Properties tab has a checkbox for printing. -- Dick Kusleika MVP - Excel www.dicks-clicks.com EJC wrote: I have a work hours spread sheet that has combo boxes for start and end times within certain days. I have the combo boxes linked to the cell behind it and populated with hours of the day. The times show up fine when selected, such as 6:00; when I print the sheet or use print preview, the value in the combo box then displays 0.25 (like a quarter of a day). I reselect the box and can repopulate 6:00. It does the same thing for dates too. Is there code in VB that I can write that will allow these values to be printed as times, and not as decimals? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the help. I am however, printing the
comboboxes (using controls toolbox, not forms, you are correct). I have the cell underneath the combo box formatted to time, and I have the combo box formatted for time also, using: cbo_ET6b.Value = Format(cbo_ET6b.Value, "hh:mm") The combo boxes hold thier value and formatting until I print (or print preview). When I do this, the values in the boxes go from time and dates to decimals. Would you like to take a look at the file? Thanks, EJC -----Original Message----- EJC It sounds like your using a combobox from the Control Toolbox (as opposed to the Forms toolbar). It also sounds like you have elected to not print the combobox. If all that is true, then it is the cell that is underneath that is printing, not the value in the combobox. You should be able to format that cell to look the same as the combobox. To check if you are printing the combobox, go into design mode, right click on the cb and choose Format control. The Properties tab has a checkbox for printing. -- Dick Kusleika MVP - Excel www.dicks-clicks.com EJC wrote: I have a work hours spread sheet that has combo boxes for start and end times within certain days. I have the combo boxes linked to the cell behind it and populated with hours of the day. The times show up fine when selected, such as 6:00; when I print the sheet or use print preview, the value in the combo box then displays 0.25 (like a quarter of a day). I reselect the box and can repopulate 6:00. It does the same thing for dates too. Is there code in VB that I can write that will allow these values to be printed as times, and not as decimals? . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
EJC
You're right. Try this: Remove the cell link from the combobox properties and put this code behind the combobox. Private Sub ComboBox1_Change() Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "h:mm AM/PM") Me.Range("F14").Value = Me.ComboBox1.Value Me.Range("F14").NumberFormat = "h:mm AM/PM" End Sub Change the range reference to whatever the LinkedCell was and change the format to whatever you want. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "EJC" wrote in message ... Thanks for the help. I am however, printing the comboboxes (using controls toolbox, not forms, you are correct). I have the cell underneath the combo box formatted to time, and I have the combo box formatted for time also, using: cbo_ET6b.Value = Format(cbo_ET6b.Value, "hh:mm") The combo boxes hold thier value and formatting until I print (or print preview). When I do this, the values in the boxes go from time and dates to decimals. Would you like to take a look at the file? Thanks, EJC -----Original Message----- EJC It sounds like your using a combobox from the Control Toolbox (as opposed to the Forms toolbar). It also sounds like you have elected to not print the combobox. If all that is true, then it is the cell that is underneath that is printing, not the value in the combobox. You should be able to format that cell to look the same as the combobox. To check if you are printing the combobox, go into design mode, right click on the cb and choose Format control. The Properties tab has a checkbox for printing. -- Dick Kusleika MVP - Excel www.dicks-clicks.com EJC wrote: I have a work hours spread sheet that has combo boxes for start and end times within certain days. I have the combo boxes linked to the cell behind it and populated with hours of the day. The times show up fine when selected, such as 6:00; when I print the sheet or use print preview, the value in the combo box then displays 0.25 (like a quarter of a day). I reselect the box and can repopulate 6:00. It does the same thing for dates too. Is there code in VB that I can write that will allow these values to be printed as times, and not as decimals? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Getting Combo boxes to change options based on other Combo boxes. | New Users to Excel | |||
Macro Printing One Sheet with one change at a time | Excel Discussion (Misc queries) | |||
Selecting subsets using combo boxes or list boxes | Excel Discussion (Misc queries) | |||
Questions on combo boxes and list boxes. | New Users to Excel | |||
List boxes/combo boxes | Excel Programming |