Results 1 to 4 of 4

VBA not cutting off copy

Threaded View

  1. #1
    Registered User
    Join Date
    07-28-2015
    Location
    LA, Cali
    MS-Off Ver
    2010
    Posts
    2

    VBA not cutting off copy

    I have this VBA to copy a row from a master sheet. I want it to stop pasting data after row L. Any thoughts as to what is wrong?
    Dim ws As Worksheet, wo As Worksheet
        Dim r As Long, lr As Long, lc As Long, n As Long, sr As Long, nr As Long
        sr = 4
        Set ws = Sheets("Raw Data - Funnel")
        Set wo = Sheets("Corporate Funnel")
        lr = ws.Cells(Rows.Count, 2).End(xlUp).Row
        lc = ws.Cells(3, Columns.Count).End(xlToLeft).Column
        For r = 4 To lr Step 1
            n = Application.CountIf(ws.Range(ws.Cells(r, 4), ws.Cells(r, lc)), "Corporate")
            If n > 0 Then
                nr = wo.Range("B" & Rows.Count).End(xlUp).Offset(1).Row
                If nr < sr Then nr = sr
                ws.Rows(r).Copy wo.Rows(nr)
            End If
    Last edited by Leith Ross; 07-28-2015 at 04:59 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Text cutting
    By faisal.ta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2013, 04:31 AM
  2. cutting and pasting in VBA
    By ben5496 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2011, 05:07 PM
  3. Cutting Formula ?
    By petersona01 in forum Excel General
    Replies: 5
    Last Post: 10-05-2011, 10:43 AM
  4. Cutting Formula?
    By petersona01 in forum Excel General
    Replies: 1
    Last Post: 09-30-2011, 01:19 PM
  5. Bar Cutting Optimization????
    By sajferris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2006, 04:05 AM
  6. Bar Cutting Optimization????
    By sajferris in forum Excel General
    Replies: 1
    Last Post: 08-10-2006, 06:15 AM
  7. Cutting every other row from a spreadsheet
    By jc40 in forum Excel General
    Replies: 2
    Last Post: 05-31-2006, 03:04 AM
  8. cutting text
    By Aaron in forum Excel General
    Replies: 1
    Last Post: 12-15-2005, 12:15 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