• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy rows to different sheets if sheet name matches with Text of A column Tweak required

Code:
Sub CopyRowDemo()
Dim Rw As Long, LstRwRaw As Long, NxtRwDest As Long
Application.ScreenUpdating = False
LstRwRaw = Sheets("Raw Data").Cells(Rows.Count, "B").End(xlUp).Row
For Rw = 3 To LstRwRaw
    With Sheets(Cells(Rw, "B").Value)
        If .Range("B6") = "" Then
            NxtRwDest = 6
        Else
            NxtRwDest = .Cells(Rows.Count, "B").End(xlUp).Row + 1
        End If
        Rows(Rw).Copy .Cells(NxtRwDest, "A")


        With .Cells(NxtRwDest + 1, "G")
            .Formula = "=Sum(G6:G" & NxtRwDest & ")"
            .Font.Bold = True
            .Copy .Offset(, 1).Resize(, 26)
        End With

    End With
Next Rw
Application.ScreenUpdating = True
End Sub

I have 100+ sheets in excel & the main data sheet is named as "raw data". I have to copy rows from "raw data" sheet to every sheet if the text of Column B matches with the sheet name.
I am using the above code to copy the data from Raw Data sheet to different sheet from G to AG row starting from pasting the data B6 onward in respective sheet. With the above code I am getting the sum of all the sheets below the data.

I need some more tweaks in the code

1. I want a merged Text "TOTAL" in A to F column in each sheet.
2. I have an another sheet named "Abstract" where I want to automatically link the TOTAL of each sheet on C onward.
For example in the Abstract sheet, those sheets TOTAL will be linked which Sheet names are there in the Sheet.

For example as per the picture uploaded I have a sheet named Stars but as the name Star is not present in the Abstract sheet that sheet total is not required to be linked.

And again a TOTAL of the abstract sheet is required.

What should be the change in the code required ? kindly check the images to understand better.

1m.JPG

3.JPG


4.JPG


5.JPG

__________________________________________________________________
Mod edit : thread moved to appropriate forum !
 

Attachments

  • test1.xlsm
    26.9 KB · Views: 7
Back
Top