joshman108
Active Member
- Joined
- Jul 6, 2016
- Messages
- 310
I have a macro which loops through most of the dozens of sheets in the workbook and checks to see if the selected range of cells is wider than a single column and contains 0 blank cells. If these are true it copies the selection to the "uploader" tab. This macro had been working properly for about 7 months for myself and my coworkers. Suddenly, it stopped working for me like 2 weeks ago. Now, once it reaches the end of the macro it just loops through again. I know this because I can see things are being copied over twice.
The basic code is as follows:
This basic section is replicated for all of the tabs which are potentially being copied.
Here's the thing. There is ONE SPECIFIC copy of this code for one specific tab which, when I delete it from the macro and re-run, it tends to run perfectly fine. But this is not always the case and furthermore, when I save the workbook and re open it with that specific section still being removed, the macro STILL loops through twice. I tried removing other un-used chunks of code (commented sections/old tabs etc) and after each attempt the macro seems to work... until I close and reopen. I also tried re-writing some sections which also appeared to fix it.. UNTIL I saved and reopened at which point it still loops through twice. So all of my attempts appear to be red-hearings and not really the root of the problem. And in the midst of all of this my coworkers are still using the macro without any problems.
I am so baffled. Does anyone have any insight?
I'm on the most recent version of excel for mac.
Thanks
The basic code is as follows:
Code:
If Worksheets("GumGum").Visible = True Then
Worksheets("GumGum").Activate
count = WorksheetFunction.CountBlank(Selection.Cells)
lngcols = Selection.Columns.count
lngrows = Selection.Rows.count
If lngcols > 1 And count = 0 Then
Selection.Copy
Worksheets("UPLOADER").Activate
ActiveCell.PasteSpecial Paste:=xlPasteValues
If lngrows = 1 Then
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Else
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
End If
Else
End If
Else
End If
This basic section is replicated for all of the tabs which are potentially being copied.
Here's the thing. There is ONE SPECIFIC copy of this code for one specific tab which, when I delete it from the macro and re-run, it tends to run perfectly fine. But this is not always the case and furthermore, when I save the workbook and re open it with that specific section still being removed, the macro STILL loops through twice. I tried removing other un-used chunks of code (commented sections/old tabs etc) and after each attempt the macro seems to work... until I close and reopen. I also tried re-writing some sections which also appeared to fix it.. UNTIL I saved and reopened at which point it still loops through twice. So all of my attempts appear to be red-hearings and not really the root of the problem. And in the midst of all of this my coworkers are still using the macro without any problems.
I am so baffled. Does anyone have any insight?
I'm on the most recent version of excel for mac.
Thanks
Last edited: