Results 1 to 7 of 7

How to copy rows in one sheet if it contains text which is present on another sheet column

Threaded View

  1. #1
    Registered User
    Join Date
    02-06-2018
    Location
    INDIA
    MS-Off Ver
    2016
    Posts
    6

    Post How to copy rows in one sheet if it contains text which is present on another sheet column

    Hello Friends,

    I am working on a macro where it should automatically compare value which is present in A column on one sheet with values in another sheet. If that particular value matches then it should automatically copy that row and paste in to another sheet whose sheet name is compared value.
    Sub sats()
    Dim s As Integer
    A = Worksheets("PROJECT_DETAILS").Cells(Rows.Count, 1).End(xlUp).Row
    
        B = Worksheets("TASK_DETAILS").Cells(Rows.Count, 1).End(xlUp).Row
        For j = 5 To B
        For I = 4 To A
        If Worksheets("TASK_DETAILS").Cells(j, 1).Value = Worksheets("PROJECT_DETAILS").Cells(I, 1).Value Then
        s = Worksheets("PROJECT_DETAILS").Cells(I, 1).Value
        Worksheets("TASK_DETAILS").Rows(j).Copy
        ThisWorkbook.Worksheets("s").Activate
            c = Worksheets("s").Cells(Rows.Count, 1).End(xlUp).Row
            Worksheets("s").Cells(c + 1, 1).Select
            ActiveSheet.Paste
            Worksheets("TASK_DETAILS").Activate
            Else
        End If
        Next I
        Next j
    
        Application.CutCopyMode = False
        
    End Sub
    This is my code, if i run it , It is showing "subscript out of range" error. PLease help.
    Last edited by satskutty; 02-06-2018 at 01:50 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Vba code to color text in sheet 1 based on key words present in next sheet.
    By sapnawat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2018, 04:26 AM
  2. [SOLVED] Macro to filter sheet 1 - 10 with a unique text value and copy all the rows in sheet 11
    By Shayk in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-18-2017, 07:13 PM
  3. [SOLVED] Copy Column A data to Sheet 2 where rows matches Sheet 2 headers
    By SCDE in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2015, 12:14 AM
  4. [SOLVED] Copy rows from active sheet to another sheet (last row) if condition in column X is met
    By mortless in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2013, 08:11 AM
  5. Copy Rows into a new sheet if a column has certain text entered
    By SusieE76 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-13-2012, 02:31 AM
  6. Copy Data from one column in a sheet to another column present in 2nd sheet
    By pan07 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-21-2012, 12:50 AM
  7. Copy Sheet & Create New Monthly Sheet From Present Sheet
    By unley in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-16-2010, 12:00 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