Does copying and pasting via VBA mess the sheet up?
I have been running some code that works fine initially but eventually starts to make the SHEET run very slowly. Meaing, if I reopen the book and NOT enable macros the sheet that was running the code moves very slowly.
So, does copy/paste damage the sheet in some way after repeated use? I mean, why would the sheet start running slow even when I am not running code? What is the connection?
I am looking for general understanding regarding this.
Just for information, here is what I am doing:
I have a workbook with 6 sheets in pairs. Meaning one sheet is sort of a defualt and its mate can be altered.
The user can make changes to a sheet and then choose to save or cancel the changes. If they save the changes, the default is then updated to match the changes. If they decide not to save the changes, the changed sheet is then updated to match the default.
I am running the same macro for all sheets, yet for some reason, one sheet keeps getting bogged down.
I am trying to copy/paste with formatting.
Here are the lines of code I am using.
This code updates the default:
This code restores the altered sheet to the default:
Honestly, I don't konw that this is the cause of my problem or not, but it seemed like a logical place to start. It is a bit challenging to diagnose the problem as it works fine initially and then random seems to bog down.
I have been running some code that works fine initially but eventually starts to make the SHEET run very slowly. Meaing, if I reopen the book and NOT enable macros the sheet that was running the code moves very slowly.
So, does copy/paste damage the sheet in some way after repeated use? I mean, why would the sheet start running slow even when I am not running code? What is the connection?
I am looking for general understanding regarding this.
Just for information, here is what I am doing:
I have a workbook with 6 sheets in pairs. Meaning one sheet is sort of a defualt and its mate can be altered.
The user can make changes to a sheet and then choose to save or cancel the changes. If they save the changes, the default is then updated to match the changes. If they decide not to save the changes, the changed sheet is then updated to match the default.
I am running the same macro for all sheets, yet for some reason, one sheet keeps getting bogged down.
I am trying to copy/paste with formatting.
Here are the lines of code I am using.
This code updates the default:
Code:
ActiveSheet.Range(OrigRange).Copy Destination:=Sheets(X).Range(OrigRange)
ActiveSheet.Range(Note).Copy Destination:=Sheets(X).Range(Note)
This code restores the altered sheet to the default:
Code:
Sheets(X).Range(OrigRange).Copy Destination:=ActiveSheet.Rang(OrigRange)
Sheets(X).Range(Note).Copy Destination:=ActiveSheet.Range(Note)
Honestly, I don't konw that this is the cause of my problem or not, but it seemed like a logical place to start. It is a bit challenging to diagnose the problem as it works fine initially and then random seems to bog down.