|
-
Jan 24th, 2011, 10:48 AM
#1
Thread Starter
Member
Can VBA code change itself?
Hello all,
Not my usual type of question but one just as irritating. This past Friday I updated an application with new VBA code. It was a straight copy and paste from my prototype workbook (Proto File = Excel 2007 Macro Enabled Workbook).
So far I have identified several irregularities between the code from my prototype workbook and the hardfile kept on our server.
First, I sometimes use "Shapes" with text as buttons to run my code. Since Friday, the text in several of these items have changed to display nothing at all, or a portion of the text it should have, Ex: "Reset Generator" now is "Reset", and "-- Generate RCR Reports --" is now blank. Further, I have assigned macro's to these two buttons, and the link to the macro has dissapeared.
To make matters worse, a segment of code has somehow moved itself. I have two modules, RCRGenerator, and GenerateRCRReports. Approximately twenty lines of code have shifting from the Reports module to the other module in a random location. The code looks like this:
Code:
'Removes plans that shouldn't be there
Dim y As Long
Dim myE As Range
Set myE = Range("D16")
For y = 1 To 25
If myE.Offset(y, 0).Value = "" Then myE.Offset(y, 1).ClearContents
Next y
Dim myF As Range
Set myF = Range("D16")
For y = 1 To 25
If myF.Offset(y, 0).Value = "" Then myF.Offset(y, 2).ClearContents
Next y
etc...
I went back to my proto spreadsheet were I took the code and it is all correct. The file in our server is wrong. I was able to fix this easily enough, but concern is this: I have over five thousand lines of code, do I need to check it line by line?
And what the hell happened?
Facts:
- I wrote the code into two different modules, when I was ready to implement I allowed the file on our server to be overwritten, updated the code, then saved the file again as "Read-Only".
- I did a straight copy and paste from my proto spreadsheet to the server file.
- Noone in our office can code or even read VBA for that matter. I updated the code Friday after everyone left, noone came in over the weekened, and this morning the file on our server has errors.
- The last backup was 1.19.2011, and I updated the file on my desktop and the server on 1.21.2011
Last edited by briancarlson; Jan 24th, 2011 at 10:52 AM.
Reason: Changed backup date
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|