Results 1 to 44 of 44

Copy Paste cells to next sheeet

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-24-2005
    Posts
    104

    Copy Paste cells to next sheeet

    Dear Colleagues please help me I am working to manage vba code but fail. My code work well but one issue involved that data has been pasted on Sheet 2 . I need data on sheet 2 date wise as shown in the image.


    Sub CopyRows()
    Dim lRow As Integer


    lRow = Sheets("Sheet1").Range("H" & Rows.Count).End(xlUp).Row

    For Each cell In Sheets("sheet1").Range("F9:F" & lRow)
    If Cells(cell.Row, "F").Value = "Cash" Then

    Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("D" & cell.Row).Value
    Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("F" & cell.Row).Value
    Sheets("Sheet2").Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("H" & cell.Row).Offset(2, 0).Value

    End If
    Next cell


    For Each cell In Sheets("sheet1").Range("G9:G" & lRow)
    If Cells(cell.Row, "G").Value = "Cash" Then
    Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("D" & cell.Row).Offset(-1, 0).Value
    Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("G" & cell.Row).Value

    Sheets("Sheet2").Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Value = _
    Sheets("Sheet1").Range("H" & cell.Row).Offset(1, 0).Value

    End If


    Next cell

    End sub
    Attached Images Attached Images
    Last edited by internet_imran; 08-25-2015 at 01:36 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Open another excel file and copy data to sheet 2 while button upload is in sheeet 1
    By rflorentino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-27-2014, 08:47 PM
  2. copy maths equation from one sheeet to other sheet
    By newmake in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 01-28-2014, 09:46 AM
  3. Copy & paste in macro doesn't paste all cells
    By pltrapper in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-13-2013, 09:22 AM
  4. [SOLVED] VBA to Copy set data, paste into set cells, then copy more & set into cells related 2 date
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 99
    Last Post: 02-01-2013, 08:43 AM
  5. Replies: 1
    Last Post: 01-16-2013, 05:36 AM
  6. Problem with copy data from "sales" sheet to each customer sheeet
    By jimparker65 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2013, 04:46 AM
  7. Copy and paste non consecutive cells and paste consecutively in another workbook
    By macquhele in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-12-2011, 02:36 PM

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