Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. Dim a As String
  2. Dim c As Range
  3. a = TextBox3.Text
  4. For Each c In [A1:A1000]
  5. If c.Value = a Then
  6. c.Offset(0).Select
  7. Exit For
  8. End If
  9. Next
  10.  
  11. If ActiveCell.Text = a Then
  12. g = ActiveCell.AddressLocal(-1)
  13. Range(g, "$A$1").Interior.Color = vbWhite
  14. Range(g, "$A$1").Font.Color = vbBlack
  15. cat = ActiveCell.AddressLocal
  16. Range(cat, "$A$1000").Interior.Color = vbBlue
  17. Range(cat, "$A$1000").Font.Color = vbWhite
  18. Label3.Caption = WorksheetFunction.Sum(Range(cat, "$A$1000"))
  19. Else
  20. MsgBox ("Такого занчения не найдено!")
  21. End If
  22.  
  23. var spreadsheet = SpreadsheetApp.getActive();
  24. spreadsheet.getRange('A1').activate();
  25. spreadsheet.getCurrentCell().setFormula('=СЛУЧМЕЖДУ($E$3;$F$3');
  26. spreadsheet.getActiveRange().autoFill(spreadsheet.getRange('A1:A1000'),
  27. SpreadsheetApp.AutoFillSeries.DEFAULT_SERIES);
  28. spreadsheet.getRange('A1:A1000').activate();
  29.  
  30. Sub FindValue()
  31. Dim c As Range
  32. Dim a As Double, bFlag As Boolean
  33. a = TextBox3.Text
  34.  
  35. For Each c In [A1:A1000]
  36. If c.Value = a Then
  37. With Range(c, [A1000])
  38. .Interior.Color = vbBlue: .Font.Color = vbWhite
  39. End With
  40.  
  41. With Range([A1], c)
  42. .Interior.Color = vbWhite: .Font.Color = vbBlack
  43. End With
  44.  
  45. Label3.Caption = Application.Sum(Range(c, [A1000]))
  46. bFlag = True: Exit For
  47. End If
  48. Next c
  49.  
  50. If bFlag = False Then MsgBox "Значение " & a & " не найдено!", 64, ""
  51. End Sub
Add Comment
Please, Sign In to add comment