function onEdit(e) {
var range = e.range;
var sheet = range.getSheet();
var names = ['Расход 09.19', 'Расход 10.19', 'Расход 11.19', 'Расход 12.19', 'Расход 01.20', 'Расход 02.20'];
if (names.indexOf(sheet.getName()) == -1) {
return false;
}
var col = range.getColumn();
var row = range.getRow();
var offset = 2;
if ((col > 4) && ((col - 5) % 3 == 0)) {
if (range.offset(0, offset).getValues() == '') {
sheet.getRange(row, col + offset).setValue(Utilities.formatDate(new Date(), 'GMT+03:00', 'HH:mm'));
}
}
}
CTRL
+SHIFT
+ВВОД
:=СУММ(ЗНАЧЕН(ПСТР(A1:A5;ПОИСК("(";A1:A5)+1;ПОИСК(")";A1:A5)-ПОИСК("(";A1:A5)-1)))
=СУММ(ЕСЛИОШИБКА(ЗНАЧЕН(ПСТР(A1:A6;ПОИСК("(";A1:A6)+1;ПОИСК(")";A1:A6)-ПОИСК("(";A1:A6)-1));0))
Sub ShiftUpEmptyCells()
Dim List As Worksheet
Set List = Excel.ActiveWorkbook.Worksheets("list")
' Пробегаем столбец "A" с конца и ищем первую непустую строку
For I = Rows.Count To 1 Step -1
If Not IsEmpty(List.Cells(I, 1)) Then
' Продолжаем пробегать от найденной, но уже удаляя пустые ячейки со сдвигом вверх
For J = I To 1 Step -1
If IsEmpty(Cells(J, 1)) Then
Cells(J, 1).Delete shift:=xlUp
End If
Next J
Exit For
End If
Next I
End Sub
Sub AppendExt()
Dim WB As Workbook
Dim WS As Worksheet
Dim Ri As Integer
Dim Rj As Integer
Dim Ci As Integer
Dim Cj As Integer
Set WB = Excel.ActiveWorkbook
Set WS = WB.Worksheets("list1")
' Диапазон ячеек для замены
' Начальная строка
Ri = 1
' Конечная строка
Rj = 4
' Начальный столбец
Ci = 1
' Конечный столбец
Cj = 2
For C = Ci To Cj
For R = Ri To Rj
If Not IsEmpty(WS.Cells(R, C)) Then
WS.Cells(R, C).Value = WS.Cells(R, C).Value & ".jpg"
End If
Next R
Next C
End Sub
Sub AppendExt()
Dim WB As Workbook
Dim WS As Worksheet
Set WB = Excel.ActiveWorkbook
Set WS = WB.Worksheets("list1")
For Each HL In WS.Hyperlinks
HL.Address = HL.Address & ".jpg"
Next
End Sub
=ПРАВСИМВ(A1;2)&"-"&ПСТР(A1;4;2)&"-"&ЛЕВСИМВ(A1;2)
Sub ReverseString()
Dim WB As Workbook
Dim WS As Worksheet
Dim R As Integer
Set WB = Excel.ActiveWorkbook
Set WS = WB.Worksheets("reverse")
' Меняется столбец A1
R = 1
While (WS.Cells(R, 1).Value <> "")
s = Split(WS.Cells(R, 1).Value, "-")
WS.Cells(R, 1).Value = Join(Array(s(2), s(1), s(0)), "-")
R = R + 1
Wend
End Sub
Dim WB as Workbook
Dim WS as Worksheet
Dim i as Integer
Set WB = Excel.ActiveWorkbook
Set WS = WB.Worksheets("Лист1")
i = 1
For b = 2 To 8 Step 2
For c = 4 To 10 Step 2
For d = 10 To 50 Step 10
' Выводит числа в столбик '
WS.Cells(i, 1).Value = 10 + b * c * d
i = i + 1
Next d
Next c
Next b