Current location - Health Preservation Learning Network - Slimming men and women - How to use "a moon algorithm about VB-transferred from CSDN" in Excel?
How to use "a moon algorithm about VB-transferred from CSDN" in Excel?
Option explicit

Dim WeekName(7), month addd( 1 1), NongliData(99), Tiangan (9), Zhizhi (1 1), Xia Shu.

ng( 1 1),DayName(30),MonName( 12)

Dim curTime、curYear、curMonth、curDay、curWeekday

Dim GongliStr,WeekdayStr,NongliStr,NongliDayStr

Dim i,m,n,k,isEnd,bit,TheDate

Private Sub-Form _Load ()

Get the current system time

curTime = Now()

Name of the week

WeekName(0) = " * "

WeekName( 1) = "Sunday "

WeekName(2) = "Monday"

Day Name (3) = "Tuesday"

WeekName(4) = "Wednesday"

WeekName(5) = "Thursday"

Day Name (6) = "Friday"

WeekName(7) = "Saturday"

Tianganming

Heavenly dry (0) = "one"

Tiangan (1) = "b"

Tiangan (2) = "C"

Tiangan (3) = "Ding"

Tiangan (4) = "E"

Heavenly dry (5) = "self"

Tiangan (6) = "more"

Tiangan (7) = "Heart"

Tiangan (8) = "Ren"

Tiangan (9) = "Deck"

Name of earthly branch

Dizhi (0) = "Zi"

Vertical (1) = "ugly"

Vertical (2) = "Yin"

Di Zhi (3) = "Mao"

Di Zhi (4) = "Chen"

Vertical (5) = "Yes"

Vertical (6) = "noon"

Question 7) = "No"

Dizhi (8) = "Shen"

Dizhi (9) = "unitary"

Vertical (10) = "Xu"

Vertical (1 1) = "sea"

Animal constellation name

Shuxiang (0) = "Mouse"

Shuxiang (1) = "Niu"

Shuxiang (2) = "Tiger"

Shuxiang (3) = "Rabbit"

Shuxiang (4) = "Dragon"

Shuxiang (5) = "snake"

Shuxiang (6) = "Horse"

Shuxiang (7) = "sheep"

Shuxiang (8) = "Monkey"

Shuxiang (9) = "Chicken"

Shuxiang (10) = "dog"

Shuxiang (1 1) = "pig"

Lunar date name

DayName(0) = "* "

DayName( 1) = "Grade One"

DayName(2) = "Grade 2"

DayName(3) = "Grade Three"

Day Name (4) = "Level 4"

DayName(5) = "Day 5"

DayName(6) = "Day 6"

DayName(7) = "Day 7"

Day name (8) = "Grade 8"

DayName(9) = "Day 9"

DayName( 10) = "Day 10"

Day name (1 1) = "Eleven"

DayName( 12) = "Twelve"

DayName( 13) = "thirteen"

Day name (14) = "14"

Day name (15) = "15"

DayName( 16) = "16"

DayName( 17) = "17"

Day name (18) = "18"

DayName( 19) = "Nineteen"

DayName(20) = "Twenty "

Day name (2 1) = "2 1 "

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) = "thirty"

Lunar month name

MonName(0) = "* "

MonName( 1) = "positive"

MonName(2) = "two "

MonName(3) = "three"

MonName(4) = "four"

MonName(5) = "five "

MonName(6) = "six "

MonName(7) = "seven "

MonName(8) = "eight"

MonName(9) = "Nine"

MonName( 10) = "ten"

MonName( 1 1) = "Eleven"

MonName( 12) = "La "

The first few days of each month in the Gregorian calendar

MonthAdd(0) = 0

month addd( 1)= 3 1

MonthAdd(2) = 59

MonthAdd(3) = 90

MonthAdd(4) = 120

MonthAdd(5) = 15 1

month addd(6)= 18 1

month addd(7)= 2 12

MonthAdd(8) = 243

MonthAdd(9) = 273

month addd( 10)= 304

month addd( 1 1)= 334

Lunar data

NongliData(0) = 2635

NongliData( 1) = 333387

NongliData(2) = 170 1

NongliData(3) = 1748

NongliData(4) = 26770 1

NongliData(5) = 694

NongliData(6) = 239 1

NongliData(7) = 133423

NongliData(8) = 1 175

NongliData(9) = 396438

NongliData( 10) = 3402

NongliData( 1 1)= 3749

NongliData( 12)= 33 1 177

NongliData( 13)= 1453

NongliData( 14) = 694

NongliData( 15)= 20 1326

NongliData( 16) = 2350

NongliData( 17)= 465 197

NongliData( 18)= 322 1

NongliData( 19) = 3402

NongliData(20) = 400202

NongliData(2 1)= 290 1

NongliData(22) = 1386

NongliData(23)= 2676 1 1

NongliData(24) = 605

NongliData(25) = 2349

NongliData(26)= 1375 15

NongliData(27) = 2709

NongliData(28) = 464533

NongliData(29) = 1738

NongliData(30) = 290 1

NongliData(3 1)= 33042 1

NongliData(32) = 1242

NongliData(33) = 265 1

NongliData(34) = 199255

NongliData(35) = 1323

NongliData(36) = 529706

NongliData(37) = 3733

NongliData(38) = 1706

NongliData(39) = 398762

NongliData(40) = 274 1

NongliData(4 1)= 1206

NongliData(42) = 267438

NongliData(43) = 2647

NongliData(44)= 13 18

NongliData(45) = 204070

NongliData(46) = 3477

NongliData(47) = 46 1653

NongliData(48) = 1386

NongliData(49) = 24 13

NongliData(50) = 330077

NongliData(5 1)= 1 197

NongliData(52) = 2637

NongliData(53) = 268877

NongliData(54) = 3365

NongliData(55)= 53 1 109

NongliData(56) = 2900

NongliData(57) = 2922

NongliData(58) = 398042

NongliData(59) = 2395

NongliData(60)= 1 179

NongliData(6 1)= 2674 15

NongliData(62) = 2635

NongliData(63) = 66 1067

NongliData(64)= 170 1

NongliData(65) = 1748

NongliData(66) = 398772

NongliData(67) = 2742

NongliData(68) = 239 1

NongliData(69) = 33003 1

NongliData(70)= 1 175

NongliData(7 1)= 16 1 1

NongliData(72) = 2000 10

NongliData(73) = 3749

NongliData(74) = 5277 17

NongliData(75) = 1452

NongliData(76) = 2742

NongliData(77) = 332397

NongliData(78) = 2350

NongliData(79) = 3222

NongliData(80) = 268949

NongliData(8 1) = 3402

NongliData(82) = 3493

NongliData(83) = 133973

NongliData(84) = 1386

NongliData(85) = 4642 19

NongliData(86) = 605

NongliData(87) = 2349

NongliData(88) = 334 123

NongliData(89) = 2709

NongliData(90) = 2890

NongliData(9 1) = 267946

NongliData(92) = 2773

NongliData(93) = 592565

NongliData(94)= 12 10

NongliData(95) = 265 1

NongliData(96) = 395863

NongliData(97) = 1323

NongliData(98) = 2707

NongliData(99) = 265877

Generate the current Gregorian calendar year, month and day = => Gong Li.

curYear = Year(curTime)

CurMonth = month (curTime)

curDay = Day(curTime)

Gong gongli str = curyear & "year"

if(curMonth & lt; 10)

Gong liStr = gong GongliStr & amp0 & amp; Ke Yue&"Moon"

other

Gong liStr = gong gonglistr & ke yue&"moon"

If ... it will be over.

if(curDay & lt; 10)

Gong liStr = gong GongliStr & amp0 & amp; Curday & "day"

other

Gong liStr = gong GongliStr & ampcurDay & amp "day"

If ... it will be over.

Generate the current Gregorian calendar week = => working day Str

CurWeekday = working day (curTime)

WeekdayStr = WeekName(curWeekday)

Start time1921Days from February 8th: 192 1-2-8 (the first day of the first month).

the date =(cur year- 192 1)* 365+Int((cur year- 192 1)/4)+curDay+Mont

hAdd(curMonth - 1) - 38

If ((curYear Mod 4) = 0 and curMonth & gt2) then

Date = date+1

If ... it will be over.

Calculate the heavenly stems and earthly branches month and day of the lunar calendar.

isEnd = 0

m = 0

do

if(NongliData(m)& lt; 4095) So

k = 1 1

other

k = 12

If ... it will be over.

n = k

do

If (n<0) then

Exit Do

If ... it will be over.

Gets the value of the nth binary bit of NongliData(m)

bit = NongliData(m)

For i = 1 to n steps 1

bit = Int(bit / 2)

then

bit = bit Mod 2

if(the date & lt; = 29+bits) Then

isEnd = 1

Exit Do

If ... it will be over.

TheDate = TheDate-29 digits

n = n - 1

ring

If (isEnd = 1) then

Exit Do

If ... it will be over.

m = m + 1

ring

curYear = 192 1 + m

curMonth = k - n + 1

curDay = TheDate

If (k = 12) then

If (Curmonth = (int (nonglidata (m)/65536)+1)), then

curMonth = 1 - curMonth

else if(cur month & gt; (int (nonglidata (m)/65536)+1)) and then

curMonth = curMonth - 1

If ... it will be over.

If ... it will be over.

Generation of heavenly stems and earthly branches Zodiac of Lunar New Year = => Non-list.

NongliStr = "Lunar New Year"&; Tiangan ((4 years) 60 days) 10 days); Di Zhi ((curYea

r-4)Mod 60)Mod 12)& amp; "year"

NongliStr = NongliStr & amp"(" & Shuxiang ((4 years) mod 60) mod12); ")"

Generate lunar month and day = = > non-calendar str

if(curMonth & lt; 1) and then

NongliDayStr = " leap " &; MonName(- 1 * curMonth)

other

NongliDayStr = MonName(curMonth)

If ... it will be over.

Nonglidaystr = nonglidaystr & "moon"

Nonglidaystr = nonglidaystr & Japanese name

Msgbox nongli str&non-liDayStr

End joint