Results 1 to 8 of 8

MAcro works OK in Step into debug mode but not doing job when run from command button

Threaded View

caabdul MAcro works OK in Step into... 03-04-2018, 09:12 AM
AB33 Re: MAcro works OK in Step... 03-04-2018, 09:43 AM
Marc L Re: MAcro works OK in Step... 03-04-2018, 09:46 AM
caabdul Re: MAcro works OK in Step... 03-04-2018, 10:08 AM
caabdul Re: MAcro works OK in Step... 03-04-2018, 10:01 AM
caabdul Re: MAcro works OK in Step... 03-10-2018, 07:03 AM
bakerman2 Re: MAcro works OK in Step... 03-10-2018, 09:25 AM
caabdul Re: MAcro works OK in Step... 03-10-2018, 10:16 AM
  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    MAcro works OK in Step into debug mode but not doing job when run from command button

    I have macro that runs OK when run by continually pressing F8 key and imports about 100 rows

    However when I run with command button, it only imports 2 lines and then stops imemdiately without any error.

    Sub SDrops()
    Dim ws As Worksheet
    
    Sheets("SunDps").Activate
    Range("A3:G" & Application.Max(3, Range("A1000000").End(xlUp).Row)).ClearContents
    empt = Cells(1, 4).Value
    i = 3
    For Each ws In ThisWorkbook.Worksheets
        If ws.Name = "G" Or ws.Name = "H" Then
        Lrw = ws.Range("F1000000").End(xlUp).Row
        ws.Activate
            For rs = 2 To Lrw
                If Cells(rs, 3).Value = empt And Cells(rs, 7).Value <> "y" Then
                    Cells(rs, 3).EntireRow.Copy
                    Sheets("SunDps").Range("A" & i).PasteSpecial Paste:=xlPasteValues
                    i = i + 1
                End If
            Next rs
        End If
    Next ws
    End Sub
    Last edited by caabdul; 03-10-2018 at 11:34 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Single step works fine but command button has errors
    By CptCrunch51 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-11-2017, 01:07 PM
  2. [SOLVED] VBA code works in debug mode but misses steps running in normal mode
    By supereeg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2016, 05:42 AM
  3. [SOLVED] A command button that works while in manual mode??
    By TDeRanger in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-12-2014, 07:14 AM
  4. VBA code only works correctly in Debug mode
    By tpthatsme in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-09-2012, 12:51 PM
  5. Macro Works but not in Debug Step mode
    By Bob Smedley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2006, 12:35 PM
  6. How show value of variable by mouse-over in debug single step mode
    By Chet Shannon in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-06-2006, 11:35 AM
  7. How show value of variable in single step debug mode?
    By Chet Shannon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2005, 03:00 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