관련: 지식인

 

스핀버튼을 넣어서 누를 때마다 개수가 반영되어 계산되게 해보았습니다.

아래와 같은 코드가 Slide1에 사용되었습니다.

Function getCell(r As Integer, c As Integer) As TextRange

    Dim sld As Slide
    Dim shp As Shape
    
    Set sld = Slide1
    Set shp = sld.Shapes("표 1")
    Set getCell = shp.Table.Cell(r, c).Shape.TextFrame.TextRange
    
End Function

Function doCalc()

    getCell(5, 2) = Format(Val(getCell(4, 2)) + Val(getCell(4, 3)) + Val(getCell(4, 4)), "###,###,###")
    
End Function

Private Sub SpinButton1_SpinDown()
    Dim tr As TextRange
    Set tr = getCell(3, 2)
    tr = tr - 1
    getCell(4, 2) = getCell(2, 2) * tr
    doCalc
End Sub

Private Sub SpinButton1_SpinUp()
    Dim tr As TextRange
    Set tr = getCell(3, 2)
    tr = tr + 1
    getCell(4, 2) = getCell(2, 2) * tr
    doCalc
End Sub
 
Private Sub SpinButton2_SpinDown()
    Dim tr As TextRange
    Set tr = getCell(3, 3)
    tr = tr - 1
    getCell(4, 3) = getCell(2, 3) * tr
    doCalc
End Sub

Private Sub SpinButton2_SpinUp()
    Dim tr As TextRange
    Set tr = getCell(3, 3)
    tr = tr + 1
    getCell(4, 3) = getCell(2, 3) * tr
    doCalc
End Sub

Private Sub SpinButton3_SpinDown()
    Dim tr As TextRange
    Set tr = getCell(3, 4)
    tr = tr - 1
    getCell(4, 4) = getCell(2, 4) * tr
    doCalc
End Sub

Private Sub SpinButton3_SpinUp()
    Dim tr As TextRange
    Set tr = getCell(3, 4)
    tr = tr + 1
    getCell(4, 4) = getCell(2, 4) * tr
    doCalc
End Sub

실행화면입니다.

 

 

총액에 1000단위 마다 콤마를 찍게했습니다.

첨부 파일 참고하세요.

 

총액계산1.pptm
0.05MB