Hello
I try getting data from first sheet to the others sheets based on column A , if the names in column A are matched with sheet name ,then should add data before TOTAL row with calculation new added data in TOTAL row for each sheet . it should start from row 18 for each sheet because the rows where precede it I have to fill manually .
note: when bring data should not copy to the bottom repeatedly as my code does it . should clear from before TOTAL row and after row 17 if there is existed from basic before bring data from first sheet.
I use in my code select and paste . seems bad way !!
Sub getting_values()
Set WS = ActiveWorkbook.Sheets("MAIN")
Dim cl As Range, i As Integer
For i = 1 To Sheets.Count
For Each cl In WS.Range("a13:a" & WS.[a10000].End(xlUp).Row)
If cl.Value = Sheets(i).Name Then
Sheets(i).Range("a" & Sheets(i).[a10000].End(xlUp).Row + 1).EntireRow.Insert
Sheets("MAIN").Select
cl.Offset(0, 2).Resize(1, 5).Copy
Sheets(i).Range("a" & Sheets(i).[a10000].End(xlUp).Row + 1).PasteSpecial xlPasteValues
End If
Next
Next
End Sub
any way to guide me how arrange this chaos for this code,please?