Vba将数字插入powerpoint表

时间:2013-08-08 22:28:47

标签: powerpoint powerpoint-vba

我无法使用vba获取powerpoint表来显示某些值,我希望它根据某个文本框中的数字填充表格,但它只会插入最后的值(TextBox1.Value = 63 Or 64 Or 65)并忽略其余的值。

Private Sub Percentiles()

    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2,  2).Shape.TextFrame.TextRange _
    .Text = 19
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 15
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 13
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 6 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 20
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 14
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 6.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 19
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 16
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 13
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 7 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 28
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 24
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 14
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 7.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = "-"
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 39
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 33
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 16
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 12
    If TextBox1.Value = 8 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 11
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 41
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 36
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 29
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 14
    If TextBox1.Value = 8.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 12
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 43
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 39
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 31
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 19
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 15
    If TextBox1.Value = 9 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 13
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 45
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 34
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 16
    If TextBox1.Value = 9.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 14
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 47
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 43
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 37
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 29
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 18
    If TextBox1.Value = 10 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 15
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 49
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 46
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 40
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 31
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 20
    If TextBox1.Value = 10.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 50
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 47
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 34
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 11 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 18
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 52
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 49
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 44
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 37
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 29
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 23
    If TextBox1.Value = 11.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 20
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 54
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 50
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 46
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 39
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 30
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 12 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 55
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 52
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 48
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 34
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 12.5 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 24
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 55
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 54
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 49
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 44
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 37
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 30
    If TextBox1.Value = 13 Or 14 Or 15 Or 16 Or 17 Or 18 Or 19 Or 20 Or 21 Or 22 Or 23 Or 24 Or 25 Or 26 Or 27 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 54
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 52
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 47
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 33
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 26
    If TextBox1.Value = 28 Or 29 Or 30 Or 31 Or 32 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 23
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 54
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 50
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 46
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 39
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 30
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 33 Or 34 Or 35 Or 36 Or 37 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 52
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 49
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 44
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 37
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 29
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 23
    If TextBox1.Value = 38 Or 39 Or 40 Or 41 Or 42 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 20
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 50
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 47
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 34
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 43 Or 44 Or 45 Or 46 Or 47 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 18
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 49
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 46
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 40
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 31
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 20
    If TextBox1.Value = 48 Or 49 Or 50 Or 51 Or 52 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 17
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 47
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 43
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 37
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 29
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 22
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 18
    If TextBox1.Value = 53 Or 54 Or 55 Or 56 Or 57 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 15
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 45
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 42
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 34
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 27
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 21
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 16
    If TextBox1.Value = 58 Or 59 Or 60 Or 61 Or 62 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 13
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(2, 2).Shape.TextFrame.TextRange _
    .Text = 43
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(3, 2).Shape.TextFrame.TextRange _
    .Text = 39
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(4, 2).Shape.TextFrame.TextRange _
    .Text = 31
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(5, 2).Shape.TextFrame.TextRange _
    .Text = 25
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(6, 2).Shape.TextFrame.TextRange _
    .Text = 19
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(7, 2).Shape.TextFrame.TextRange _
    .Text = 15
    If TextBox1.Value = 63 Or 64 Or 65 Then ActivePresentation.Slides(62).Shapes(3).Table.Cell(8, 2).Shape.TextFrame.TextRange _
    .Text = 13

End Sub

1 个答案:

答案 0 :(得分:2)

您应该对条件进行分组。尝试类似:

Private Sub Percentiles()
    With ActivePresentation.Slides(62).Shapes(3).Table
        ' Check values in Double (CDbl) or Single (CSng)
        Select Case CDbl(TextBox1.Value)
            Case 6
                .Cell(2, 2).Shape.TextFrame.TextRange.Text = 19
                .Cell(3, 2).Shape.TextFrame.TextRange.Text = 17
                ' etc ... (you should see the pattern now)
            Case 6.5
                .Cell(2, 2).Shape.TextFrame.TextRange.Text = 22
                .Cell(3, 2).Shape.TextFrame.TextRange.Text = 20
                ' etc ...
            ' Case .... You fill in the rest of the Cases here
            Case 63 To 65
                .Cell(6, 2).Shape.TextFrame.TextRange.Text = 19
                .Cell(7, 2).Shape.TextFrame.TextRange.Text = 15
                .Cell(8, 2).Shape.TextFrame.TextRange.Text = 13
            Case Else
                Debug.Print "OUT OF RANGE CASE"
                '.Cell(Row, Col).Shape.TextFrame.TextRange.Text = ""
                ' What to do when it is not in any of the condition you are checking
        End Select
    End With
End Sub

如果你还没有得到这个想法,请告诉我们。

相关问题