+ Reply to Thread
Results 1 to 4 of 4

copying a cell to another cell automatically

  1. #1
    Amit
    Guest

    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



  2. #2
    Forum Contributor
    Join Date
    09-05-2004
    Location
    Melbourne
    Posts
    193
    try this code placed on the sheet that you want this to happen on. That is, in the Visual Basic Editor, select the Microsoft Excel Objects folder and double click on Sheet1 if it is Sheet1 that needs this event to occur.

    Private Sub Worksheet_Change(ByVal Target As Range)

    On Error GoTo Finish

    If Target.Column = 5 And Target.Value = 1 Then _
    Cells(Target.Row, 1).Value = Format(1, "0%")

    Finish:

    Application.EnableEvents = True

    End Sub

  3. #3
    David Jessop
    Guest

    RE: copying a cell to another cell automatically

    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
    >
    >
    >


  4. #4
    Amit
    Guest

    Re: copying a cell to another cell automatically

    Awesome, thanks!


    "David Jessop" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    > >
    > >
    > >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1