Sub goCalcMoney()
'관세율
tradeTaxRate = Cells(2, 2)
addTaxRate = Cells(3, 2)
moneyRate = Cells(4, 2)
Range(Cells(13, 2), Cells(24, 7)).Value = 0
k = 2
Do While k < 8
goodsMoney = Cells(8, k)
InType = Cells(6, k)
If goodsMoney < 1 Or goodsMoney = "" Then
Else
transFee = Cells(9, k)
taxFee = Cells(10, k)
weightAll = Cells(11, k)
'1차 합계
totalDallor = goodsMoney + transFee + taxFee
sumKoreaWon = totalDallor * moneyRate
Cells(13, k) = sumKoreaWon
'과세운임
i = 2
Do While i < 999
startWeight = Cells(i, 16)
If startWeight < weightAll Then
i = i + 1
Else
If sumKoreaWon > 200000 Then
transTaxFee = Cells(i - 1, 19).Value
Cells(14, k).Value = transTaxFee
Else
transTaxFee = Cells(i - 1, 18).Value
Cells(14, k).Value = transTaxFee
End If
i = 999
End If
Loop
'과세기준
standardTax = sumKoreaWon + transTaxFee
Cells(15, k) = standardTax
'관세
If standardTax < 150000 Or (goodsMoney < 200 And InType = "목록") Then
afterTax = sumKoreaWon
afterAddTax = sumKoreaWon
tradeType = "비과세"
Else
afterTax = standardTax * (1 + (tradeTaxRate / 100))
afterAddTax = afterTax * (1 + (addTaxRate) / 100)
tradeType = ""
End If
Cells(16, k) = afterTax
Cells(17, k) = afterAddTax
Cells(18, k) = afterAddTax - transTaxFee
Cells(12, k) = tradeType
'운송비
i = 4
Do While i < 999
'몰테일 배송비
mstartWeight = Cells(i, 10)
If mstartWeight < weightAll Then
i = i + 1
Else
mTransFee = Cells(i, 11).Value
i = 999
End If
Loop
lastTransFee = mTransFee
wonLastTF = lastTransFee * moneyRate
Cells(19, k) = wonLastTF
If standardTax < 150000 Or (goodsMoney < 200 And InType = "목록") Then
Cells(20, k) = afterAddTax + wonLastTF
Else
Cells(20, k) = afterAddTax + wonLastTF - transTaxFee
End If
' Cells(21, k) = feeSource
i = 4
Do While i < 999
'이하넥스 배송비
estartWeight = Cells(i, 10)
If estartWeight < weightAll Then
i = i + 1
Else
eLTransFee = Cells(i, 13).Value
eNTransFee = Cells(i, 14).Value
i = 999
End If
Loop
If eLTransFee > eNTransFee Then
lastTransFee = eNTransFee
feeSource = "이하넥스 뉴저지"
Else
lastTransFee = eLTransFee
feeSource = "이하넥스 LA"
End If
wonLastTF = lastTransFee * moneyRate
Cells(21, k) = wonLastTF
If standardTax < 150000 Or (goodsMoney < 200 And InType = "목록") Then
Cells(22, k) = afterAddTax + wonLastTF
Else
Cells(22, k) = afterAddTax + wonLastTF - transTaxFee
End If
'예상 세금
Cells(23, k) = feeSource
Cells(24, k) = afterAddTax - transTaxFee - sumKoreaWon
End If
k = k + 1
Loop
End Sub
'MACRO' 카테고리의 다른 글
엑셀매크로를 잘 정리해서 글을 써봐야겠네요. (0) | 2013.06.07 |
---|---|
오래된 책을 나눠 드립니다. 혹시 필요하신 분 (0) | 2013.05.19 |