Forum Discussion
Changing already made macro from Excel 2010 to 2013
Thank you very much for response. I am wondering where I should put sheet name "Daily Cover Page Data" in the code you mentioned.
Regards
Matt Mickle wrote:If the Calendar is a shape on the worksheet you may try using something like this instead (See attached example):
Private Sub Worksheet_Activate() With Me.Shapes.Range("Calendar1") .Height = 124.5 .Left = 195 .Top = 45 .Width = 174.75 End With End Sub
Note: You will have to paste this code into the workbook yourself, since macro enabled files are not permitted on the forum due to security risks.
Hey Muhammad-
It is not necessary to add the worksheet name into the code. Me refers to the worksheet. Please note this is a Worksheet Event and the VBA code needs to be put in the "Daily Cover Page Data" worksheet module.
Similarly, if you were in a Userform code module Me would refer to the userform. So rather than typing
UserForm1.TextBox1
you can just use:
Me.TextBox1
If you want you can add in though... it would look like this:
Private Sub Worksheet_Activate() With Sheets("Daily Cover Page Data").Shapes.Range("Calendar1") .Height = 124.5 .Left = 195 .Top = 45 .Width = 174.75 End With End Sub
- Muhammad AliJun 25, 2018Copper Contributor
Thank you Sir, It worked.
Now I am getting Compile Error: "Can't Find project or library" on below code:
daCurrentMonthSheet = Format(VBA.Date - 1, "mmm")
Thanks- Matt MickleJun 25, 2018Bronze Contributor
Try this:
daCurrentMonthSheet = Format(Date - 1, "mmm")
- Muhammad AliJun 28, 2018Copper Contributor
Thank you, it fixed it now its stuck on below with same error:
daMonthSheet = Format(Sheets("Daily Cover Page Data").Calendar1, "mmm")
iCol = Format(Sheets("Daily Cover Page Data").Calendar1, "dd") + 6