简体   繁体   English

Vba将数字插入到powerpoint表格中

[英]Vba to insert numbers into powerpoint table

I'm having trouble getting a powerpoint table to display certain values with vba, I want it to fill the table according to the number in a certain textbox, but it keeps inserting only the last values ( TextBox1.Value = 63 Or 64 Or 65 ) and ignores the rest of the values.我无法使用 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

You should group the conditions.您应该对条件进行分组。 Try something like:尝试类似:

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

Let us know if you don't get the idea yet.如果您还不明白,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM