1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| Public Function Fun_GetEngName(ByVal argColumn As Integer) As String Dim strEngName As String Dim iNum, iMod As Integer
iNum = argColumn \ 26 iMod = argColumn Mod 26 If (iMod = 0) Then If (iNum = 1) Then strEngName = Chr(90) Else strEngName = Chr(65 + iNum - 2) + Chr(90) End If Else If (iNum = 0) Then strEngName = Chr(65 + iMod - 1) Else strEngName = Chr(65 + iNum - 1) + Chr(65 + iMod - 1) End If End If Fun_GetEngName = strEngName End Function
Private Sub CommandButton1_Click() Rows("1:1").Interior.ColorIndex = 2 Rows("2:2").Interior.ColorIndex = 2 Dim idate As Date idate = Format(Now, "yyyy/m/d") MsgBox "Today is " & idate & ", have a nice day!", , "Auto Dater, by H.Q." Worksheets(1).Cells(171, 3).Value = idate Dim i i = Worksheets(1).Cells(171, 5).Value Worksheets(1).Cells(2, i).Interior.ColorIndex = 8 Worksheets(1).Cells(1, i).Interior.ColorIndex = 8 Dim s As String s = Fun_GetEngName(i - 1) ActiveSheet.ChartObjects("TimingStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$107:$" & s & "$111") ActiveSheet.ChartObjects("SleepingStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$107:$" & s & "$107") ActiveSheet.ChartObjects("EntertainmentStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$110:$" & s & "$110") ActiveSheet.ChartObjects("StudyStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$108:$" & s & "$108") ActiveSheet.ChartObjects("NormalStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$109:$" & s & "$109") ActiveSheet.ChartObjects("TechStatistics").Activate ActiveChart.SetSourceData Source:=Range("Main!$A$2:$" & s & "$2,Main!$A$111:$" & s & "$111") End Sub
|