如何在Excel中使用“一个关于VB的月亮算法——转自CSDN”?
Dim WeekName(7)、month addd(11)、NongliData(99)、天干(9)、地直(11)、夏树
ng(11),DayName(30),MonName(12)
Dim curTime、curYear、curMonth、curDay、curWeekday
Dim GongliStr,WeekdayStr,NongliStr,NongliDayStr
Dim i,m,n,k,isEnd,bit,TheDate
私有子窗体_Load()
获取当前系统时间
curTime = Now()
本周名称
WeekName(0) = " * "
WeekName(1) = "Sunday "
WeekName(2) = "星期一"
星期名称(3) = "星期二"
WeekName(4) = "星期三"
WeekName(5) = "星期四"
星期名称(6) = "星期五"
WeekName(7) = "星期六"
天干名
天干(0) =“一”
天干(1)=“B”
天干(2) =“丙”
天干(3) =“定”
天干(4)=“E”
天干(5) =“己”
天干(6) =“更”
天干(7) =“心”
天干(8) =“壬”
天干(9) =“癸”
地支名称
嫡支(0) =“子”
地直(1) =“丑”
地直(2) =“阴”
邸志(3) =“毛”
狄志(4) =“陈”
地直(5) =“是”
地直(6) =“正午”
第七题)=“不是”
嫡之(8) =“申”
嫡支(9) =“酉”
地直(10) =“许”
地直(11) =“海”
动物星座名称
书香(0) =“鼠”
书香(1) =“牛”
书香(2) =“老虎”
书香(3) =“兔子”
书香(4) =“龙”
书香(5) =“蛇”
书香(6) =“马”
书香(7) =“羊”
书香(8) =“猴”
书香(9) =“鸡”
书香(10) =“狗”
书香(11) =“猪”
农历日期名称
DayName(0) = "* "
DayName(1) = "一年级"
DayName(2) = "等级2 "
DayName(3) =“初三”
日名(4) = "四级"
DayName(5) = "第五天"
DayName(6) = "第六天"
DayName(7) = "第七天"
day name(8)= " 8级"
DayName(9) = "第九天"
DayName(10) = "第10天"
日名(11) = "十一"
DayName(12) = "十二"
DayName(13) = "十三"
日名(14) = "14 "
日名(15) = "15 "
DayName(16) = "十六"
DayName(17) = "十七"
日名(18) = "18 "
DayName(19) = "十九"
DayName(20) = "Twenty "
日名(21) = "21 "
DayName(22) = "22 "
DayName(23) = "23 "
DayName(24) = "24 "
DayName(25) = "25 "
DayName(26) = "26 "
DayName(27) = "27 "
DayName(28) = "28 "
DayName(29) = "29 "
DayName(30) = "三十"
农历月份名称
MonName(0) = "* "
MonName(1) = "正"
MonName(2) = "two "
MonName(3) = "三"
MonName(4) = "四"
MonName(5) = "five "
MonName(6) = "six "
MonName(7) = "seven "
MonName(8) = "八"
MonName(9) = "九"
MonName(10) = "十"
MonName(11) = "十一"
MonName(12) = "La "
公历中每个月的前几天
MonthAdd(0) = 0
month addd(1)= 31
MonthAdd(2) = 59
MonthAdd(3) = 90
MonthAdd(4) = 120
MonthAdd(5) = 151
month addd(6)= 181
month addd(7)= 212
MonthAdd(8) = 243
MonthAdd(9) = 273
month addd(10)= 304
month addd(11)= 334
月球数据
NongliData(0) = 2635
NongliData(1) = 333387
NongliData(2) = 1701
NongliData(3) = 1748
NongliData(4) = 267701
NongliData(5) = 694
NongliData(6) = 2391
NongliData(7) = 133423
NongliData(8) = 1175
NongliData(9) = 396438
NongliData(10) = 3402
NongliData(11)= 3749
NongliData(12)= 331177
NongliData(13)= 1453
NongliData(14) = 694
NongliData(15)= 201326
NongliData(16) = 2350
NongliData(17)= 465197
NongliData(18)= 3221
NongliData(19) = 3402
NongliData(20) = 400202
NongliData(21)= 2901
NongliData(22) = 1386
NongliData(23)= 267611
NongliData(24) = 605
NongliData(25) = 2349
NongliData(26)= 137515
NongliData(27) = 2709
NongliData(28) = 464533
NongliData(29) = 1738
NongliData(30) = 2901
NongliData(31)= 330421
NongliData(32) = 1242
NongliData(33) = 2651
NongliData(34) = 199255
NongliData(35) = 1323
NongliData(36) = 529706
NongliData(37) = 3733
NongliData(38) = 1706
NongliData(39) = 398762
NongliData(40) = 2741
NongliData(41)= 1206
NongliData(42) = 267438
NongliData(43) = 2647
NongliData(44)= 1318
NongliData(45) = 204070
NongliData(46) = 3477
NongliData(47) = 461653
NongliData(48) = 1386
NongliData(49) = 2413
NongliData(50) = 330077
NongliData(51)= 1197
NongliData(52) = 2637
NongliData(53) = 268877
NongliData(54) = 3365
NongliData(55)= 531109
NongliData(56) = 2900
NongliData(57) = 2922
NongliData(58) = 398042
NongliData(59) = 2395
NongliData(60)= 1179
NongliData(61)= 267415
NongliData(62) = 2635
NongliData(63) = 661067
NongliData(64)= 1701
NongliData(65) = 1748
NongliData(66) = 398772
NongliData(67) = 2742
NongliData(68) = 2391
NongliData(69) = 330031
NongliData(70)= 1175
NongliData(71)= 1611
NongliData(72) = 200010
NongliData(73) = 3749
NongliData(74) = 527717
NongliData(75) = 1452
NongliData(76) = 2742
NongliData(77) = 332397
NongliData(78) = 2350
NongliData(79) = 3222
NongliData(80) = 268949
NongliData(81) = 3402
NongliData(82) = 3493
NongliData(83) = 133973
NongliData(84) = 1386
NongliData(85) = 464219
NongliData(86) = 605
NongliData(87) = 2349
NongliData(88) = 334123
NongliData(89) = 2709
NongliData(90) = 2890
NongliData(91) = 267946
NongliData(92) = 2773
NongliData(93) = 592565
NongliData(94)= 1210
NongliData(95) = 2651
NongliData(96) = 395863
NongliData(97) = 1323
NongliData(98) = 2707
NongliData(99) = 265877
生成当前公历年、月、日= = & gt巩俐斯特
curYear = Year(curTime)
curMonth =月(curTime)
curDay = Day(curTime)
巩GongliStr = curYear & amp"年份"
if(curMonth & lt;10)
巩liStr =巩GongliStr & amp0 & amp;柯月& amp“月亮”
其他
巩liStr =巩GongliStr & amp柯月& amp“月亮”
如果…就会结束
if(curDay & lt;10)
巩liStr =巩GongliStr & amp0 & amp;curDay & amp“日”
其他
巩liStr =巩GongliStr & ampcurDay & amp“日”
如果…就会结束
生成当前公历周= = & gt工作日Str
curWeekday =工作日(curTime)
WeekdayStr = WeekName(curWeekday)
起始时间1921 2月8日起天数:1921-2-8(正月初一)。
the date =(cur year-1921)* 365+Int((cur year-1921)/4)+curDay+Mont
hAdd(curMonth - 1) - 38
If ((curYear Mod 4) = 0且curMonth & gt2)然后
日期=日期+ 1
如果…就会结束
计算农历的天干地支月日。
isEnd = 0
m = 0
做
if(NongliData(m)& lt;4095)那么
k = 11
其他
k = 12
如果…就会结束
n = k
做
如果(n & lt0)然后
出口Do
如果…就会结束
获取NongliData(m)的第n个二进制位的值
bit = NongliData(m)
对于i = 1到n步1
bit = Int(bit / 2)
然后
bit = bit Mod 2
if(the date & lt;= 29 +位)那么
isEnd = 1
出口Do
如果…就会结束
TheDate = TheDate - 29位
n = n - 1
环
If (isEnd = 1)则
出口Do
如果…就会结束
m = m + 1
环
curYear = 1921 + m
curMonth = k - n + 1
curDay = TheDate
如果(k = 12)那么
if(cur month =(Int(NongliData(m)/65536)+1))则
curMonth = 1 - curMonth
else if(cur month & gt;(Int(NongliData(m)/65536)+1))然后
curMonth = curMonth - 1
如果…就会结束
如果…就会结束
生成农历的天干地支生肖= = & gt非列表者
NongliStr = "农历新年" &;天干((4年)60日)10日);迪志(((curYea
r-4)Mod 60)Mod 12)& amp;"年份"
NongliStr = NongliStr & amp"(" & amp书香(((4年)Mod 60)Mod 12);")"
生成农历月和日== >非liDayStr
if(curMonth & lt;1)然后
NongliDayStr = " leap " &;MonName(-1 * curMonth)
其他
NongliDayStr = MonName(curMonth)
如果…就会结束
NongliDayStr = NongliDayStr & amp“月亮”
NongliDayStr = NongliDayStr & amp日名
MsgBox NongliStr & amp非liDayStr
末端接头