ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   copying a cell to another cell automatically (https://www.excelbanter.com/new-users-excel/4838-copying-cell-another-cell-automatically.html)

Amit

copying a cell to another cell automatically
 
Hi,
I'm trying to set up my worksheet so that if the value in column E is
changed to 100%, the value in column A of that row automatically changes to
100, regardless of its original value. At the same time, I don't want to
lock down column A - the user can enter any value in here when E is not
100%. How do I go about doing this? Do I need to write a macro?
Thanks!
Amit



David Jessop

Hi,

You'll have to do this as a little macro. Go into the VB editor and add the
following into the relevant Sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 And Target = 100 Then
Cells(Target.Row, 1) = 100
End If
End Sub

You might want to check for ABS (target - 100) < some small number rather
than equality.

HTH, David Jessop

"Amit" wrote:

Hi,
I'm trying to set up my worksheet so that if the value in column E is
changed to 100%, the value in column A of that row automatically changes to
100, regardless of its original value. At the same time, I don't want to
lock down column A - the user can enter any value in here when E is not
100%. How do I go about doing this? Do I need to write a macro?
Thanks!
Amit




Amit

Awesome, thanks!


"David Jessop" wrote in message
...
Hi,

You'll have to do this as a little macro. Go into the VB editor and add

the
following into the relevant Sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 And Target = 100 Then
Cells(Target.Row, 1) = 100
End If
End Sub

You might want to check for ABS (target - 100) < some small number rather
than equality.

HTH, David Jessop

"Amit" wrote:

Hi,
I'm trying to set up my worksheet so that if the value in column E is
changed to 100%, the value in column A of that row automatically changes

to
100, regardless of its original value. At the same time, I don't want to
lock down column A - the user can enter any value in here when E is not
100%. How do I go about doing this? Do I need to write a macro?
Thanks!
Amit







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

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