Consulting

Results 1 to 3 of 3

Thread: worksheet change function

  1. #1

    worksheet change function

    Hi All,

    I want to use the worksheet change function but need help.

    I have a spreadsheet where if someone types in cell A3, A4, A5 etc, I want to add a formula in to Y3, Y4, Y5 etc. In otherwords, each time someone enters in column A, a formula is entered in column Y for the corresponding row.

    Is this possible?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A:A"

    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    .Offset(0,24).Formula = your_formula here
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub
    [/vba]
    'This is worksheet event code, which means that it needs to be
    'placed in the appropriate worksheet code module, not a standard
    'code module. To do this, right-click on the sheet tab, select
    'the View Code option from the menu, and paste the code in.
    Last edited by Bob Phillips; 10-10-2006 at 10:02 AM.

  3. #3
    thank you, seems to work a treat

Posting Permissions

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