31st of January is missing in my calendar

2019-10-01 16:20发布

As you can see in the screenshots the calendar is showing just 30 days of January and the day 31 is missing. when I try to add this day manually by adding a new column(AG) it works. but when i scroll to the next month which is February the column AG turns blank! and when I scroll back to January its again 30 days! enter image description here enter image description here enter image description here

标签: excel
1条回答
欢心
2楼-- · 2019-10-01 16:46

Because You hide Columns("C:NI") and unhide only 30 columns from column C to column AF.

Range("B3").Value equals to 1 and Range("B3").Value * 31 - 29 equals to 2. Likewise, Range("B3").Value * 31 + 1 equals to 32. So, you unhide only 30 columns (32-2)! Just change your VBA code Range("B3").Value * 31 - 29 to Range("B3").Value * 31 -28 and Range("B3").Value * 31 + 1 to Range("B3").Value * 31 + 2 :

Sub showcalendar()
   LeaveTracker.Columns("C:NJ").Hidden = True
   LeaveTracker.Range(Columns(Range("B3").Value * 31 - 28), Columns(Range("B3").Value * 31 + 2)).Hidden = False
End Sub

And one more thing, change all Column()-1 to Column()-2 in your excel formulaes. Here is your repaired workbook. Check and tell me any your ideas.

查看更多
登录 后发表回答