Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Make cell entry event change another cell?

Hi.

When a particular value is entered into one cell, I want to cause
another value to be set into a different cell. This different cell is
in the same row at an offset.

I wrote a little macro to cause an offset from the active cell to get
set, but I don't know how to cause this macro to run when the value is
changed in the "trigger" cell.

Specifically, I have a little "to-do" spreadsheet. One column
indicates completion status with a "Y" or "N". Another column
indicates completion date. So when the status changes to "Y", I want
that event to run the macro that will set the completion date to
Today().

Any help would be greatly appreciated!

Thanks,

Ken

P.S.: I am running Excel 97.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Make cell entry event change another cell?

Ken,

This worksheet event code checks for a Y being input in column B, and puts
the date in column F

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Target.Column = 2 Then
If UCase(Target.Value) = "Y" Then
Target.Offset(0, 4).Value = Format(Date, "dd mmm yyyy")
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

To enter it, right click the sheet tab, select 'View Code' from the menu,
and paste the code into the code pane shown.

To change column B, change
If Target.Column = 2 Then
to the appropriate column number.

To change the date column from F, change the 4 in
Target.Offset(0, 4).Value
to the number of columns to the right.

--

HTH

Bob Phillips

"Ken" wrote in message
om...
Hi.

When a particular value is entered into one cell, I want to cause
another value to be set into a different cell. This different cell is
in the same row at an offset.

I wrote a little macro to cause an offset from the active cell to get
set, but I don't know how to cause this macro to run when the value is
changed in the "trigger" cell.

Specifically, I have a little "to-do" spreadsheet. One column
indicates completion status with a "Y" or "N". Another column
indicates completion date. So when the status changes to "Y", I want
that event to run the macro that will set the completion date to
Today().

Any help would be greatly appreciated!

Thanks,

Ken

P.S.: I am running Excel 97.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Make cell entry event change another cell?

Thanks. Worked great!

One follow-up question:

I wanted to cause a default value to be set in one of the cells when a
new row is entered. Specifically, I want to set the cell in the
Completed column to be "N".

How would that be done?

Thanks so much,

Ken

"Bob Phillips" wrote in message ...
Ken,

This worksheet event code checks for a Y being input in column B, and puts
the date in column F

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Target.Column = 2 Then
If UCase(Target.Value) = "Y" Then
Target.Offset(0, 4).Value = Format(Date, "dd mmm yyyy")
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

To enter it, right click the sheet tab, select 'View Code' from the menu,
and paste the code into the code pane shown.

To change column B, change
If Target.Column = 2 Then
to the appropriate column number.

To change the date column from F, change the 4 in
Target.Offset(0, 4).Value
to the number of columns to the right.

--

HTH

Bob Phillips

"Ken" wrote in message
om...
Hi.

When a particular value is entered into one cell, I want to cause
another value to be set into a different cell. This different cell is
in the same row at an offset.

I wrote a little macro to cause an offset from the active cell to get
set, but I don't know how to cause this macro to run when the value is
changed in the "trigger" cell.

Specifically, I have a little "to-do" spreadsheet. One column
indicates completion status with a "Y" or "N". Another column
indicates completion date. So when the status changes to "Y", I want
that event to run the macro that will set the completion date to
Today().

Any help would be greatly appreciated!

Thanks,

Ken

P.S.: I am running Excel 97.

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
Email message on cell change event jknapp1005 Excel Worksheet Functions 1 March 17th 09 09:29 PM
Change Text Color in one cell based upon entry in referenced cell Tee Excel Discussion (Misc queries) 3 September 12th 08 10:07 PM
Change Event on a Specific Cell Sashi Excel Worksheet Functions 3 July 20th 07 11:12 PM
cell change event gvm Excel Worksheet Functions 3 September 20th 05 04:50 AM
cell value change event alinasir Excel Worksheet Functions 1 August 30th 05 10:57 AM


All times are GMT +1. The time now is 03:44 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"