May 03 2021 05:33 PM
Trouble getting sheet to move to next page and to the previous sheet using buttons in Excel
May 04 2021 03:26 AM - edited May 04 2021 03:27 AM
When you click one of the buttons, it changes the value of cell B3 on the Schedule sheet.
This causes the Worksheet_Change event procedure to run, and this calls ScheduleRefresh.
The ScheduleRefresh macro has a loop For WeekCol = 5 To 23 Step 3 ... Next WeekCol.
The second time through this loop, WeekCol equals 8.
The code adds a new sheet, and tries to rename it to the value of Cells(110, WeekCol). But Cells(110, 8), 8) i.e. cell H110, is empty. This causes an error.
Perhaps some of these steps shouldn't occur - can you explain?
May 04 2021 06:43 AM
This excel program was downloaded from Excel freelancers website and I really like how it works. I really don't know why this happens and I try to find the root cause of it. If there anything in vba code that doesn't need to be there, can you suggest any changes to it that will as normal? Thanks.
Greg
May 04 2021 06:59 AM
It looks like the code and sheet layout don't match anymore. I suspect that extra columns have been inserted for the first day (columns G, H and I). Therefore, that day does not conform to the regular structure that the code expects.
May 04 2021 07:02 AM
May 04 2021 07:12 AM
Do you want those extra columns for all days of the week, or just for the first day?
May 04 2021 07:41 AM
That will require a MAJOR rewrite of the code. Stay tuned.
May 04 2021 07:43 AM
May 04 2021 08:42 AM
Solution