+ Reply to Thread
Results 1 to 10 of 10

VBA copy and paste based on cell value

Hybrid View

  1. #1
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA copy and paste based on cell value

    Sub Shift()
    
    Dim lr As Long, lr2 As Long, r As Long
    lr = Sheets("Histogram").Cells(Rows.Count, "A").End(xlUp).Row
    lr2 = Sheets("DS Sheet").Cells(Rows.Count, "A").End(xlUp).Row
    lr3 = Sheets("NS Sheet").Cells(Rows.Count, "A").End(xlUp).Row
    For r = lr To 2 Step -1
        If Range("E" & r).Value = "DS" Then
           lr2 = Sheets("DS Sheet").Cells(Rows.Count, "A").End(xlUp).Row
            Range("B" & r).Resize(, 6).Copy Sheets("DS Sheet").Range("A" & lr2 + 1)
           
        ElseIf Range("E" & r).Value = "NS" Then
            lr3 = Sheets("NS Sheet").Cells(Rows.Count, "A").End(xlUp).Row
            Range("B" & r).Resize(, 6).Copy Sheets("DS Sheet").Range("A" & lr3 + 1)
    
        End If
    
    Next r
    End Sub
    
     Sub Shiftmine()
    
    Dim lr As Long, r As Long
    lr = Sheets("Histogram").Cells(Rows.Count, "A").End(xlUp).Row
    For r = lr To 2 Step -1
        If Range("E" & r).Value = "DS" Then
            Range("B" & r).Resize(, 6).Copy Sheets("DS Sheet").Sheets("DS Sheet").Cells(Rows.Count, "A").End(xlUp).Offset(1)
        ElseIf Range("E" & r).Value = "NS" Then
            Range("B" & r).Resize(, 6).Copy Sheets("DS Sheet").Sheets("NS Sheet").Cells(Rows.Count, "A").End(xlUp).Offset(1)
        End If
    Next r
    End Sub
    Last edited by AB33; 09-09-2014 at 12:54 PM.

+ 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. Copy and Paste based on a cell value
    By lzee61971 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2014, 09:59 PM
  2. Copy-Paste based on cell value
    By Konexcelmath in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2013, 03:32 AM
  3. [SOLVED] Copy/Paste Based on Value of Cell
    By l8tnite in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2012, 06:17 PM
  4. Copy Paste based on Cell Value
    By Bwbisel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-14-2011, 09:06 AM
  5. Copy and paste row based on cell value
    By contra76 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-20-2010, 03:23 AM

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