+ Reply to Thread
Results 1 to 4 of 4

Worksheet Change to change to cell value

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Worksheet Change to change to cell value

    Please see attached example as a guide...

    What I want is some 'Worksheet Change' code that copies the values from columns K & L in cell Y2 and Y4.

    The code should execute when a value in Columns I or J is changed and then the values in the adjacent cells in columns K and L should be inserted in to cells Y2 and Y4 of Sheet 2.

    Many Thanks,
    Adam.
    Attached Files Attached Files
    Last edited by adam2308; 08-31-2011 at 06:43 PM.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Worksheet Change to change to cell value

    Try this in the worksheet module for Sheet1
    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim isect As Range
        
        If Target.Cells.Count > 1 Then Exit Sub
        If Target.Row < 4 Then Exit Sub
    
        On Error GoTo ResetApplication
        Application.EnableEvents = False
    
        Set isect = Intersect(Target, Range("I:J"))
        
        If Not isect Is Nothing Then
            With Sheets("Sheet2")
                .Range("Y2") = Cells(Target.Row, "K")
                .Range("Y4") = Cells(Target.Row, "L")
            End With
        End If
    
    ResetApplication:
        Err.Clear
        On Error GoTo 0
        Application.EnableEvents = True
        Set isect = Nothing
    End Sub

    Is this what you need?
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    467

    Re: Worksheet Change to change to cell value

    Absolutely perfect. Thank You!

    Any chance you can help me this one..
    http://www.excelforum.com/excel-prog...her-sheet.html


  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Worksheet Change to change to cell value

    Happy to have helped.

    Mark this thread [SOLVED] then I'll have a look at your other thread.

+ 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