I currently have 3 worksheets (CB Design, INV Design, Summary) within a template workbook. I have a macro button on the CB
Design sheet that performs one function. I also have a similar macro button on the INV Design sheet. The template will always
open a file that will contain the following on the Summary sheet: cell A2 = CB1 and cell A3 = INV1. When the macro button on
CB Design sheet is pressed, I would like to add the following:
after the macro performs what it already does on the CB Design sheet, go to Summary sheet, find last row that contains
"CB", copy that row and insert it directly below itself.
When the macro button on INV Design sheet is pressed, I would like to add the following:
after the macro performs what it already does on INV Design sheet, go to Summary sheet, find last row that contains
"INV", copy that row and insert it directly below itself.
I have searched for several hours on the excel forums with no luck. The main hurdle is, I am not looking for an exact value
in the last cell (e.g. CB2), but rather just "CB" of "INV". Most of the solutions have been for specific
cells or not to find last row with the partial value.
An example that lacks the copy function, but that I tried to
modify and run as a test before incorporating it into the existing macros, but realized it is looking for an exact value is
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Cells(i, "B").Value = "CB1" Then
Rows(i + 1).Insert
Any help would be greatly appreciated.