Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Combo box question

Hi,

I have written a User Form in VBA (Excel 97). This form contains a
ComboBox and the data for this ComboBox (a series of dates is
contained in sheet 2 column A.)

I have the Row Source as Sheet2!A1:A95 and this appears to be OK when
I test it - the selected dates show in the ComboBox (Although the date
then changes to a 5 digit number)

What I haven't worked out what to do is how to tell VBA that the date
I select in the ComboBox is to be written to Sheet1 cell C2. The code
so far is:

Range("C2").Select
Selection = Clear
Range("C2").Select
Selection = ???????

What needs to go on the last line to copy the selected date into cell
C2?

Any suggestions would be very much appreciated.


--
Cheers

Peter

Remove the INVALID to reply
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combo box question

Just set the control source property to Sheet1!C2

you don't need a macro.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

I have written a User Form in VBA (Excel 97). This form contains a
ComboBox and the data for this ComboBox (a series of dates is
contained in sheet 2 column A.)

I have the Row Source as Sheet2!A1:A95 and this appears to be OK when
I test it - the selected dates show in the ComboBox (Although the date
then changes to a 5 digit number)

What I haven't worked out what to do is how to tell VBA that the date
I select in the ComboBox is to be written to Sheet1 cell C2. The code
so far is:

Range("C2").Select
Selection = Clear
Range("C2").Select
Selection = ???????

What needs to go on the last line to copy the selected date into cell
C2?

Any suggestions would be very much appreciated.


--
Cheers

Peter

Remove the INVALID to reply



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Combo box question

On Sun, 15 Feb 2004 18:43:12 -0500, "Tom Ogilvy"
wrote:

Just set the control source property to Sheet1!C2

you don't need a macro.


Hi Tom,

Many thanks for your reply - It's sorted.


--
Cheers

Peter

Remove the INVALID to reply
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Combo box question

Glad you think so.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
On Sun, 15 Feb 2004 18:43:12 -0500, "Tom Ogilvy"
wrote:

Just set the control source property to Sheet1!C2

you don't need a macro.


Hi Tom,

Many thanks for your reply - It's sorted.


--
Cheers

Peter

Remove the INVALID to reply



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Combo box question

Hi Peter,

You can skip the Select and Clear stuff and just do

Range("C2").Value = ComboBox1.Value

Of course you may have to better qualify Range("C2") so the output lands on the intended worksheet.

The date/number question is another issue.

HTH
Anders Silven

"Peter" skrev i meddelandet ...
Hi,

I have written a User Form in VBA (Excel 97). This form contains a
ComboBox and the data for this ComboBox (a series of dates is
contained in sheet 2 column A.)

I have the Row Source as Sheet2!A1:A95 and this appears to be OK when
I test it - the selected dates show in the ComboBox (Although the date
then changes to a 5 digit number)

What I haven't worked out what to do is how to tell VBA that the date
I select in the ComboBox is to be written to Sheet1 cell C2. The code
so far is:

Range("C2").Select
Selection = Clear
Range("C2").Select
Selection = ???????

What needs to go on the last line to copy the selected date into cell
C2?

Any suggestions would be very much appreciated.


--
Cheers

Peter

Remove the INVALID to reply



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Combo box question

On Mon, 16 Feb 2004 00:40:44 +0100, "Anders S"
wrote:
Hi Anvers,

Thanks very much for your reply - it works fine - and there is no
problem with the date - although it shows a number in the combobox it
appears in C2 as a correctly formated date!


Hi Peter,

You can skip the Select and Clear stuff and just do

Range("C2").Value = ComboBox1.Value

Of course you may have to better qualify Range("C2") so the output lands on the intended worksheet.

The date/number question is another issue.

HTH
Anders Silven

"Peter" skrev i meddelandet ...
Hi,

I have written a User Form in VBA (Excel 97). This form contains a
ComboBox and the data for this ComboBox (a series of dates is
contained in sheet 2 column A.)

I have the Row Source as Sheet2!A1:A95 and this appears to be OK when
I test it - the selected dates show in the ComboBox (Although the date
then changes to a 5 digit number)

What I haven't worked out what to do is how to tell VBA that the date
I select in the ComboBox is to be written to Sheet1 cell C2. The code
so far is:

Range("C2").Select
Selection = Clear
Range("C2").Select
Selection = ???????

What needs to go on the last line to copy the selected date into cell
C2?

Any suggestions would be very much appreciated.


--
Cheers

Peter

Remove the INVALID to reply


--
Cheers

Peter

Remove the INVALID to reply
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combo box question Frepez Excel Worksheet Functions 4 March 24th 05 07:08 PM
VBA Form Combo Box question. WTG Excel Discussion (Misc queries) 3 February 26th 05 04:28 PM
Combo Box Question Scott Jacobs Excel Worksheet Functions 0 November 23rd 04 01:40 AM
Combo Box Question [email protected] Excel Programming 2 January 7th 04 03:16 PM
easy combo box question jhloney Excel Programming 2 November 26th 03 01:22 AM


All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"