Results 1 to 3 of 3

help fixing my macro from running multiple times

Threaded View

MurseBry help fixing my macro from... 11-18-2010, 08:12 PM
Simon Lloyd Re: help fixing my macro from... 11-18-2010, 08:49 PM
royUK Re: help fixing my macro from... 11-19-2010, 02:17 AM
  1. #1
    Registered User
    Join Date
    11-18-2010
    Location
    Cincinnati, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    1

    help fixing my macro from running multiple times

    I have some isssues with a macro that I am running. I have the following code:

    Dim r           As Range
        Dim cell        As Range
        Dim Nextrow     As Long
    
            Set r = Intersect(Target, Range("B10:W41"))
            If r Is Nothing Then Exit Sub
            
            ' Next available row
            Nextrow = Worksheets("Transition Sheet P-S").Range("A" & Rows.Count).End(xlUp).Row + 1
            
            For Each cell In r
                With cell.EntireRow
                    If UCase(.Range("M1").Text) = "YES" And _
                       WorksheetFunction.CountA(.Range("B1:V1")) = 21 Then
                            Worksheets("Transition Sheet P-S").Cells(Nextrow, "A").Resize(1, 21).Value = _
                                                                                  .Range("B1:X1").Value
                        Nextrow = Nextrow + 1
                    End If
                End With
            Next cell
    It keeps pasting the same row over and over if I click on that line again if I click back onto the row. I would like to maybe change the way the macro is being triggered can someone explain to me how to do this or show me code that will fix this issue?
    Last edited by MurseBry; 11-18-2010 at 08:13 PM. Reason: grammar

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.6.0 RC 1