Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Generate date in cell on changing value in drop down list

Hi there,

I would need some support please on how to program in VBA the following task:
In column M of any row the user chooses in a drop down list (values 1 to 6)
one value, at which simultaneously the current date (of selection) is copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of today e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value 2 in M3 so
the date is copied into O3. At the 08/29/08 the user selects value 3 in M3 so
the date is copied into P3. And so on. Maximum of the date history would be
S3 as there are 6 values to select. This should work for all rows whereas the
columns stay the same.

Many thanks for any support.
Hannes
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Generate date in cell on changing value in drop down list

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the following task:
In column M of any row the user chooses in a drop down list (values 1 to 6)
one value, at which simultaneously the current date (of selection) is copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of today e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value 2 in M3 so
the date is copied into O3. At the 08/29/08 the user selects value 3 in M3 so
the date is copied into P3. And so on. Maximum of the date history would be
S3 as there are 6 values to select. This should work for all rows whereas the
columns stay the same.

Many thanks for any support.
Hannes

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Generate date in cell on changing value in drop down list

Could you please explain a bit more detailed how I have to adapt your code
because I am beginner in VBA programming. Thanks!

"Joel" wrote:

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the following task:
In column M of any row the user chooses in a drop down list (values 1 to 6)
one value, at which simultaneously the current date (of selection) is copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of today e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value 2 in M3 so
the date is copied into O3. At the 08/29/08 the user selects value 3 in M3 so
the date is copied into P3. And so on. Maximum of the date history would be
S3 as there are 6 values to select. This should work for all rows whereas the
columns stay the same.

Many thanks for any support.
Hannes

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Generate date in cell on changing value in drop down list

Sorry but it doesn't work. I copied the macro in the worksheet but nothing
happens.

Perhaps there is a misunderstanding of the functionality. Here an example
for clarification:

Selected value in Column Date Generate date in
cell

1 M3 08/20/08 N3
3 M3 08/23/08 P3
5 M7 08/22/08 R7
6 M7 08/23/08 S7
....
....
I hope this helps. The macro should work in real-time in the background and
generate dates depending on the value in the according column of the row.

Many thanks for not giving up on me ;-)

"Don Guillett" wrote:

Simply right click the sheet tab desiredcopy/paste the macro.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
Could you please explain a bit more detailed how I have to adapt your code
because I am beginner in VBA programming. Thanks!

"Joel" wrote:

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the following
task:
In column M of any row the user chooses in a drop down list (values 1
to 6)
one value, at which simultaneously the current date (of selection) is
copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of today
e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value 2 in
M3 so
the date is copied into O3. At the 08/29/08 the user selects value 3 in
M3 so
the date is copied into P3. And so on. Maximum of the date history
would be
S3 as there are 6 values to select. This should work for all rows
whereas the
columns stay the same.

Many thanks for any support.
Hannes





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Generate date in cell on changing value in drop down list

I get a run-time error '13': Types incompatible.

Thanks for any support!


Sorry but it doesn't work. I copied the macro in the worksheet but nothing
happens.

Perhaps there is a misunderstanding of the functionality. Here an example
for clarification:

Selected value in Column Date Generate date in
cell

1 M3 08/20/08 N3
3 M3 08/23/08 P3
5 M7 08/22/08 R7
6 M7 08/23/08 S7
...
...
I hope this helps. The macro should work in real-time in the background and
generate dates depending on the value in the according column of the row.

Many thanks for not giving up on me ;-)

"Don Guillett" wrote:

Simply right click the sheet tab desiredcopy/paste the macro.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
Could you please explain a bit more detailed how I have to adapt your code
because I am beginner in VBA programming. Thanks!

"Joel" wrote:

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the following
task:
In column M of any row the user chooses in a drop down list (values 1
to 6)
one value, at which simultaneously the current date (of selection) is
copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of today
e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value 2 in
M3 so
the date is copied into O3. At the 08/29/08 the user selects value 3 in
M3 so
the date is copied into P3. And so on. Maximum of the date history
would be
S3 as there are 6 values to select. This should work for all rows
whereas the
columns stay the same.

Many thanks for any support.
Hannes



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Generate date in cell on changing value in drop down list

If Joel doesn't come back send your workbook to my address below along with
snippets from these msgs.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
I get a run-time error '13': Types incompatible.

Thanks for any support!


Sorry but it doesn't work. I copied the macro in the worksheet but
nothing
happens.

Perhaps there is a misunderstanding of the functionality. Here an example
for clarification:

Selected value in Column Date Generate date
in
cell

1 M3 08/20/08 N3
3 M3 08/23/08 P3
5 M7 08/22/08 R7
6 M7 08/23/08 S7
...
...
I hope this helps. The macro should work in real-time in the background
and
generate dates depending on the value in the according column of the row.

Many thanks for not giving up on me ;-)

"Don Guillett" wrote:

Simply right click the sheet tab desiredcopy/paste the macro.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
Could you please explain a bit more detailed how I have to adapt your
code
because I am beginner in VBA programming. Thanks!

"Joel" wrote:

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the
following
task:
In column M of any row the user chooses in a drop down list
(values 1
to 6)
one value, at which simultaneously the current date (of selection)
is
copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of
today
e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects value
2 in
M3 so
the date is copied into O3. At the 08/29/08 the user selects value
3 in
M3 so
the date is copied into P3. And so on. Maximum of the date history
would be
S3 as there are 6 values to select. This should work for all rows
whereas the
columns stay the same.

Many thanks for any support.
Hannes



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Generate date in cell on changing value in drop down list

OP sent workbook and this is my response

In your post you NEVER mentioned that your number was NOT the only thing in
the cell. We would get the impression that you had 1,2,3,4,5,6 instead of
1-xxxd. This will fix it. There was also a problem with the offset going
down a row (fixed) and you probably do NOT need to format the date so I
commented out the last line. Un comment if necessary.

Private Sub worksheet_change(ByVal target As Range)
If target.Column = Columns("M").Column Then
target.Offset(0, Left(target, 1)) = Date
'target.Offset(0, left(target,1)).NumberFormat = "MM/DD/YY"
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
If Joel doesn't come back send your workbook to my address below along
with snippets from these msgs.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
I get a run-time error '13': Types incompatible.

Thanks for any support!


Sorry but it doesn't work. I copied the macro in the worksheet but
nothing
happens.

Perhaps there is a misunderstanding of the functionality. Here an
example
for clarification:

Selected value in Column Date Generate
date in
cell

1 M3 08/20/08
N3
3 M3 08/23/08
P3
5 M7 08/22/08
R7
6 M7 08/23/08
S7
...
...
I hope this helps. The macro should work in real-time in the background
and
generate dates depending on the value in the according column of the
row.

Many thanks for not giving up on me ;-)

"Don Guillett" wrote:

Simply right click the sheet tab desiredcopy/paste the macro.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Hannes" wrote in message
...
Could you please explain a bit more detailed how I have to adapt
your code
because I am beginner in VBA programming. Thanks!

"Joel" wrote:

You need a worksheet change function.

Private Sub worksheet_change(ByVal target As Range)

If target.Column = Columns("M").Column Then
target.Offset(0, target.Value) = Date
target.Offset(0, target.Value).NumberFormat = "MM/DD/YY"
End If
End Sub


"Hannes" wrote:

Hi there,

I would need some support please on how to program in VBA the
following
task:
In column M of any row the user chooses in a drop down list
(values 1
to 6)
one value, at which simultaneously the current date (of
selection) is
copied
into column N to S of the same row.
E.g.: User selects value 1 of drop down list in M3 so the date of
today
e.g.
08/20/08 is copied into N3. At the 08/25/08 the user selects
value 2 in
M3 so
the date is copied into O3. At the 08/29/08 the user selects
value 3 in
M3 so
the date is copied into P3. And so on. Maximum of the date
history
would be
S3 as there are 6 values to select. This should work for all rows
whereas the
columns stay the same.

Many thanks for any support.
Hannes




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
how do generate a drop down list with no blanks GMRJEN Excel Discussion (Misc queries) 2 April 27th 07 02:20 AM
drop-down list changing according to choice made choc_penguin Excel Programming 4 January 4th 06 09:50 PM
drop-down list changing according to choice made choc_penguin Excel Worksheet Functions 1 January 4th 06 06:26 PM
changing value of a cell by selecting an item from a drop down list Bobby Mir Excel Worksheet Functions 6 June 8th 05 08:33 PM
changing the font size on the drop down of a list (autofilter). Culpeper Wood Excel Programming 1 January 4th 05 12:58 AM


All times are GMT +1. The time now is 12:48 PM.

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

About Us

"It's about Microsoft Excel"