I have the below code in my "Main" Sheet.
MsgBox "Code fired"
Sheets("Main").Range("H" & 2) =Sheets("RSP").Cells.SpecialCells(xlLastCell).Row
My intention is to get the max used cells from RSP sheet and put it in Main sheet.And this code is fine, it gives me the right count. But, the code works only when I save the workbook.
Ex: My main page is currently showing Count on RSP as 50, I go to RSP sheet and add a new line at the end. When I come back to Main page, the count increases to 51. Now, if I go to RSP and delete a raw, and then come back to main page, the count is not reducing. It still shows 51. The count changes if I save the workbook, switch to some other sheet and come back to Main sheet.
I tried putting the same code in both places, i.e Worksheet_activate of Main page, and WorkSheet_Deactivate of RSP page. But no difference. And, in all the cases the messagebox is working.