Closed Thread
Results 1 to 3 of 3

Thread: Code:Excel Programming

  1. #1
    Registered User
    Join Date
    06-06-2011
    Location
    Kampala, Uganda
    MS-Off Ver
    Excel 2003
    Posts
    2

    Code:Excel Programming

    How do I make this Code apply / work after saving and closing the Workbook?

    Code:

    ' This Sub is automatically called when there is any change on this worksheet.
    ' If the change causes the value of any cell in column E to exceed 1, then the value of the
    ' the same cell in column H replaces the formula in that cell.

    Public Sub Worksheet_Change(ByVal Target As Range)
    ' Check to see if the change occurred in column E
    If Target.Column = 5 Then

    ' Check to see if the change caused the value to go above 0
    If Target.Value > 0 Then

    ' Assign the value of the corresponding cell in column B back to the cell as a value
    ' This is effectively the same as copy then "paste as value"
    Cells(Target.Row, 8).Value = Cells(Target.Row, 8).Value

    End If

    End If

    End Sub

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2007, 2010
    Posts
    25,777

    re: Code:Excel Programming

    Welcome to the forum, Joseph.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags and to have a descriptive title.

    Thanks.
    Microsoft MVP - Excel
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    re: Code:Excel Programming

    Duplicate of this one.

Closed 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.2.0