Fortune Telling Collection - Zodiac Guide - How is the zodiac calculated? Knowing a date of 2065438+April 20, how to calculate the zodiac and constellation with vba?

How is the zodiac calculated? Knowing a date of 2065438+April 20, how to calculate the zodiac and constellation with vba?

Function sx (date) as a string.

AnimalStr = "Rats, cows, tigers, rabbits, dragons, snakes, horses, sheep, monkeys, chickens, dogs and pigs"

Sx = Mid(animalStr, (year (a)-1 900) mod12+1,1)

End function

Function xz (date) as a string.

ConstellationName = "Aries, Taurus, Gemini, Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius, Pisces"

Exponent = 0

Y = year (a)

M = month (a)

D = day (a)

y = m * 100 + d

If ((y>= 32 1) and (y<= 4 19)), then

Exponent = 0

else if((y & gt; = 420) and (y < = 520)) then

Exponent = 1

else if((y & gt; = 52 1) and (y < = 620)) then

Exponent = 2

else if((y & gt; = 62 1) and (y < = 722)) then

Exponent = 3

else if((y & gt; = 723) and (y < = 822)) then

Exponent = 4

else if((y & gt; = 823) and (y < = 922)) then

Exponent = 5

else if((y & gt; = 923) and (y < =1022)) then

Exponent = 6

else if((y & gt; = 1023) and (y < =1121)) then.

Index = 7

else if((y & gt; = 1 122) and (y < =1221)) then

Exponent = 8

else if((y & gt; = 1222) or (y < =119)) then

Exponent = 9

else if((y & gt; = 120) and (y < = 218)) then

Exponent = 10

else if((y & gt; = 2 19) and (y < = 320)) then

Exponent = 1 1

Otherwise:

Exponent = 0

If ... it will be over.

xz = Mid(constellationName,Index * 4 + 1,3)

End function