ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can i combine combo boxes (https://www.excelbanter.com/excel-programming/339269-how-can-i-combine-combo-boxes.html)

beb

How can i combine combo boxes
 

Hi,

I have three combo boxes in VB user form for date (day,month,year), and
i need to combine these in an excel cell, but i cannot. Can anyone give
me a code? please...


*** Sent via Developersdex http://www.developersdex.com ***

Norman Jones

How can i combine combo boxes
 
Hi Bep,

Assume the three comboboxes are named cbxDay, cbxMonth and cbxYear, then,
for example, the requied date might be inserted using a commandbutton, thus:

'=====================
Private Sub CommandButton1_Click()
Sheets("Sheet2").Range("A1").Value = _
DateSerial(cbxYear, cbxMonth, cbxDay)
End Sub
'<<=====================

---
Regards,
Norman


"beb" wrote in message
...

Hi,

I have three combo boxes in VB user form for date (day,month,year), and
i need to combine these in an excel cell, but i cannot. Can anyone give
me a code? please...


*** Sent via Developersdex http://www.developersdex.com ***




Norman Jones

How can i combine combo boxes
 
Hi Beb,

Or, more explicitly:

'=====================
Private Sub CommandButton1_Click()
Sheets("Sheet2").Range("A1").Value = _
DateSerial(cbxYear.Value, cbxMonth.Value, cbxDay.Value)
End Sub
'<<=====================

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Bep,

Assume the three comboboxes are named cbxDay, cbxMonth and cbxYear, then,
for example, the requied date might be inserted using a commandbutton,
thus:

'=====================
Private Sub CommandButton1_Click()
Sheets("Sheet2").Range("A1").Value = _
DateSerial(cbxYear, cbxMonth, cbxDay)
End Sub
'<<=====================

---
Regards,
Norman


"beb" wrote in message
...

Hi,

I have three combo boxes in VB user form for date (day,month,year), and
i need to combine these in an excel cell, but i cannot. Can anyone give
me a code? please...


*** Sent via Developersdex http://www.developersdex.com ***






beb

How can i combine combo boxes
 

thanx Norman, it works:)


*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com