在Excel中自定义公历转换农历函数2

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

求阳历2006-11-1日对应的阴历#NAME?

求阴历2006年正月初一对应的阳历#NAME?

阳历1975年5月6日出生,今年阴历生日时对应的阳历日期#NAME?

阳历生日:阳历1975年5月6日出生,今年阳历生日时对应的阳历日期#NAME?

Dim d As

Dim Month

'1901-210

LunarCal

startyear

d = &H100

ng = ng M

d = &H80

mdata = I

ng = ng M

d = &H20

LunarData

LunarData

d = &H100

i = 1

Do

Lunar

mdata

If d

d = d

i = i

Loop

If LunarD En

Fu luna

'Part = 0

Dim a As

l_year =

a = Lunar

sp_date =

If sp_dat

l_yea

a = L

sp_da

End If

l_day = S

l_month =

IS_lunar_

y = a.Mon

Do While

l_day

If l_

If IS

y

Else

l

y

End I

Loop

l_day = l

lunar = l

If IS_lun

lunar = C En

Fu sola

'IS_lunar

Dim a As

Lunar_dat

s_year =

For Each

If C

Next

a = Lunar

sp_date =

If Lunar_

x = Lunar

tm = Luna

For i = 1

x = x

If i

x

End I

Next

s_date =

solar = s En

Fu luna

If Inquir

Inqui

lunar

If CD

End If

lunarbirt En

Fu sola

If Inquir

Inqui

solar

If CD

End If

solarbirt En

函数作用:阴阳历转换和阴阳历生日

' 说明:适用于1901-2100年间

示例:=lunar("2006-11-1")

=solar("2006-1-1") 求阴历2006年正月初一对应的阳历

=lunarbirth("1975-5-6") 阴历生日:阳历1975年5月6日出生,今年阴历生日时对应的阳历日期 =solarbirth("1975-5-6") 阳历生日:阳历1975年5月6日出生,今年阳历生日时对应的阳历日期'################################################################

Type ConvDataA

leapmonth As Integer

Month(1 To 13) As Integer

sp_month As Integer 'Solar month of Spring Festival

sp_day As Integer 'Solar day of Spring Festival

End Type

Private Function LunarData(q_year) As ConvDataA

Dim d As Long

Dim Month(1 To 13) As Integer

'1901-2100

LunarCal = Array(&H4AE53, &HA5748, &H5526BD, &HD2650, &HD9544, &H46AAB9, &H56A4D, &H9AD42, &H6A4DBE, &HA4D52, &HD2546, &H5D52BA, &HB544E, &HD6A43, &H296D37, &H95B4B, &H74 &HA4B48, &H5B25BC, &H6A550, &H6D445, &H4ADAB8, &H2B64D, &H95742, &H2497B7, &H49 &HD4A51, &HEA546, &H56D4BA, &H5AD4E, &H2B644, &H393738, &H92E4B, &H7C96BF, &HC9 &H6DA53B, &HB554F, &H56A45, &H4AADB9, &H25D4D, &H92D42, &H2C95B6, &HA954A, &H7B &HB5546, &H555ABB, &H4DA4E, &HA5B43, &H352BB8, &H52B4C, &H8A953F, &HE9552, &H6A &HAB54F, &H4B645, &H4A5739, &HA574D, &H52642, &H3E9335, &HD9549, &H75AABE, &H56 &H54AEBB, &H4AD4F, &HA4D43, &H4D26B7, &HD254B, &H8D52BF, &HB5452, &HB6A47, &H69 &H49B45, &H4A4BB9, &HA4B4D, &HAB25C2, &H6A554, &H6D449, &H6ADA3D, &HAB651, &H93 &H4974F, &H64B44, &H36A537, &HEA54A, &H86B2BF, &H5AC53, &HAB647, &H5936BC, &H92 &H4D4AB8, &HD4A4C, &HDA541, &H25AA36, &H56A49, &H7AADBD, &H25D52, &H92D47, &H5C &HB4A43, &H4B5537, &HAD54A, &H955ABF, &H4BA53, &HA5B48, &H652BBC, &H52B50, &HA9 &H6AA4C, &HAD541, &H24DAB6, &H4B64A, &H69573D, &HA4E51, &HD2646, &H5E933A, &HD5 &H36B537, &H96D4B, &HB4AEBF, &H4AD53, &HA4D48, &H6D25BC, &HD254F, &HD5244, &H5D &H56D41, &H24ADB6, &H49B4A, &H7A4BBE, &HA4B51, &HAA546, &H5B52BA, &H6D24E, &HAD &H9374B, &H8497C1, &H49753, &H64B48, &H66A53C, &HEA54F, &H6B244, &H4AB638, &HAA &H3C9735, &HC9649, &H7D4ABD, &HD4A51, &HDA545, &H55AABA, &H56A4E, &HA6D43, &H45 &H8A95BF, &HA9553, &HB4A47, &H6B553B, &HAD54F, &H55A45, &H4A5D38, &HA5B4C, &H52 &H69349, &H7729BD, &H6AA51, &HAD546, &H54DABA, &H4B64E, &HA5743, &H452738, &HD2 &HD5252, &HDAA47, &H66B53B, &H56D4F, &H4AE45, &H4A4EB9, &HA4D4C, &HD1541, &H2D9 startyear = 1901

ng = LunarCal(q_year - startyear)

d = &H100000

LunarData.leapmonth = Int(ng / d)

ng = ng Mod d

d = &H80

mdata = Int(ng / d)

ng = ng Mod d

相关文档
最新文档