+ Reply to Thread
Results 1 to 2 of 2

debug error

  1. #1
    Registered User
    Join Date
    03-15-2012
    Location
    marquette, MI
    MS-Off Ver
    Excel 2010
    Posts
    45

    debug error

    My spreadsheet takes totals and subtracts totals.

    I have about 6 columns and rows that are filled with data.
    If I try to insert a new row I get a debug error.
    The debug highlights "Application.Undo"
    Not sure why
    any suggestions?



    Private Sub Worksheet_Change(ByVal Target As Range)
    'copies the value of colum c into new cell as "old value"
    Dim nextRow As Integer
    Dim oldValues As Variant
    Dim newValues As Variant
    Dim oldRev, newRev, diffRev As Double
    Dim NumRows, NumCols As Integer
    Dim lRow, lCol As Integer
    If Not Intersect(Target, Range("C:C")) Is Nothing Then
    NumRows = Target.Cells.Rows.Count
    NumCols = Target.Cells.Columns.Count
    newValues = Target.Value2
    Application.EnableEvents = False
    Application.Undo
    oldValues = Target.Value2
    Target.Offset(0, 1).Value = Target.Value
    Target = newValues
    Application.EnableEvents = True
    End If

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,876

    Re: debug error

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. Debug Error
    By cartica in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2015, 09:23 PM
  2. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  3. WHy this debug error
    By maximpinto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-15-2014, 12:47 AM
  4. Debug error 13
    By BillGoodman in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 06-23-2009, 03:12 PM
  5. debug error?
    By mitelkm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2008, 01:27 PM
  6. [SOLVED] Error Won't Debug
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2006, 03:10 PM
  7. [SOLVED] down with the debug error
    By hurlbut777 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2005, 09:06 PM

Tags for this Thread

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