I have a main workbook that I open that has code in it. when I run the code on that workbook it copies some data, opens a template workbook, pastes the data into the template workbook, runs a macro that is in the template workbook, and saves the template workbook with a new name and closes it.
In the macro that is written in the template workbook I have it delete unneeded cells using the following code:
When I run the code directly from the template workbook it works, but when this macro is called from the main workbook the unwanted cells are not deleted. I want the cells to delete when the macro is called from my main workbook. Any help would be great, Thanks!
In the macro that is written in the template workbook I have it delete unneeded cells using the following code:
Code:
If rownum > 24 Then
rownum = rownum + 1
rowm = rowm - 2
Sheet1.Range(Cells(rownum, 1), Cells(rowm, 26)).Delete Shift:=xlUp
ElseIf rownum < 24 Or rownum = 24 Then
rowm = rowm - 1
Sheet1.Range(Cells(26, 1), Cells(rowm, 26)).Delete Shift:=xlUp
End If
When I run the code directly from the template workbook it works, but when this macro is called from the main workbook the unwanted cells are not deleted. I want the cells to delete when the macro is called from my main workbook. Any help would be great, Thanks!