2013-08-08 3 views
0

У меня возникли проблемы с получением таблицы powerpoint для отображения определенных значений с помощью vba, я хочу, чтобы она заполнила таблицу в соответствии с номером в определенном текстовом поле, но она сохраняет только последние значения (TextBox1.Value = 63 Or 64 Or 65) и игнорирует остальные значения.Vba для ввода чисел в таблицу powerpoint

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 

ответ

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 

Сообщите нам, если у вас еще нет идеи.

Смежные вопросы