Allow me to go over some technical details.
Dim rX As Range, rY As Range, i As Long
In my opinion, it is important to make your code as readable as possible.
Since rX is a range of the "Financial Statements Summary" sheet, perhaps you could call it rFSS or some such.
And since rY is a range of the ""Company 1" sheet, perhaps you could call it rC1 or some such.
"Company1" is not the same as "Company 1" (which was the name of your sheet you uploaded).
With Sheets("Financial Statements Summary")
Set rX = .Range("Summary_Format", .Cells(Rows.Count, 4).End(xlUp))
End With
It is easy to overlook (I've done it often), but you need a dot before "Rows.Count"
With the dot, "Rows" belongs with the "With" statement, without the dot, "Rows" belongs with the Active Worksheet.
In addition:
.Cells(.Rows.Count, 4).End(xlUp)
is the same as:
.Cells(.Rows.Count, "D").End(xlUp)
Because D is the 4th column. (In my opinion, "D" is more readable than "4".)
Now because there is nothing in column D, the above statement is the same as "D1".
Set rX = .Range("Summary_Format", .Cells(Rows.Count, 4).End(xlUp))
"Summary_Format" is B4:B12, and .Cells(Rows.Count, 4).End(xlUp) is "D1", the result is rX = B4:D12.
With Sheets("Company 1")
Set rY = .Range("Company1_Format", .Cells(264, Columns.Count).End(xlToLeft))
End With
You need a dot before "Columns", furthermore since there is no data in row 264,
.Cells(264, Columns.Count).End(xlToLeft) = A264.
Since "Company1_Format" = B4:B12, that with A264, makes rY = A4:B264.
As for your worksheet, it doesn't make sense that you have four identical worksheets. Company 1's worksheet should be different from Company 2's worksheet, and both should be different from Company 3's worksheet. And if your Summary worksheet only has a summary, then it won't have all the details from the other worksheets. On the other hand, a Master worksheet might contain all the data from the company worksheets. So first you need to determined the relationship of your worksheets. Once you know the relationship, you can talk about adding and deleting items. But without knowing the structure and relationship of your worksheets, it is hard for me to give any general answers on those matters.
Bookmarks