+ Reply to Thread
Results 1 to 4 of 4

Code doesn't work after closing and restarting Excel

  1. #1
    Registered User
    Join Date
    02-04-2016
    Location
    Dallas, GA
    MS-Off Ver
    2002
    Posts
    2

    Code doesn't work after closing and restarting Excel

    This is the code I'm using for running inventory, which I copied from another post. It works fine until I close out Excel, but on restart it does not work. I have no experience in writing code. Any help would be appreciated.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 6 And Target.Cells.Count = 1 Then
    Target.Offset(0, 1).Value = Target.Offset(0, 1).Value + Target.Value
    End If
    End Sub

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Code doesn't work after closing and restarting Excel

    That code needs to go into the codemodule of the worksheet:

    1) Copy the code.
    2) Right-Click the sheet tab of interest.
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file (if using XL2007 or later).

    Make sure you have macros enabled when you re-open the workbook.


    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Code doesn't work after closing and restarting Excel

    Hi Ronald,

    It seems Bernie is telling you where to put your code. Read this site for better info:

    http://www.cpearson.com/excel/codemods.htm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    02-04-2016
    Location
    Dallas, GA
    MS-Off Ver
    2002
    Posts
    2

    Re: Code doesn't work after closing and restarting Excel

    Thanks! I had the code in the right place... I just wasn't saving it correctly. Thanks so much for the assistance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. This code doesn't work when when i share the excel file ,,any hints
    By gostavee in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-08-2015, 05:13 PM
  2. [SOLVED] .EnableOutlining doesn't work after closing and re-opening the file
    By Spinner4000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-01-2014, 02:26 AM
  3. Replies: 1
    Last Post: 03-01-2013, 06:59 PM
  4. Closing other workbook doesn't work
    By desonny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-28-2011, 10:44 AM
  5. code from Excel Help doesn't work
    By ryan darrow in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2011, 01:17 PM
  6. VB code doesn't work after save/reopen - using Excel 2007
    By lgluck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2010, 08:53 AM
  7. Why doesn't this code work for Excel 2007?
    By colwyn in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2008, 06:55 AM

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