function getNestedArray(array $data) : array
{
$result = [];
foreach ($data as $key => $value) {
$path = explode('.', $key);
$current = &$result;
foreach ($path as $part) {
if (!isset($current[$part])) {
$current[$part] = [];
}
$current = &$current[$part];
}
}
return $result;
}
function addDescriptionToProducts($array, $arrayText) {
foreach ($array as &$arr) {
foreach ($arr as &$product) {
foreach ($arrayText as $text) {
if (isset($text[$product['sku']])) {
$product['desc'] = $text[$product['sku']];
break;
}
}
}
}
return $array;
}
Option Explicit
Sub Строки_на_Лист()
' не торопясь
Dim wbk As Workbook: Set wbk = ActiveWorkbook
Dim wsh_Temp As Worksheet
Set wsh_Temp = wbk.Worksheets.Add(after:=Worksheets(Worksheets.Count))
Dim wsh As Worksheet, cel As Range
For Each wsh In wbk.Worksheets
If wsh.Name <> wsh_Temp.Name Then
For Each cel In Application.Intersect(wsh.UsedRange, wsh.Columns(6).Cells)
If cel.Value < 0 Then
cel.EntireRow.Copy wsh_Temp.Cells(Row_Bottom_Number(wsh_Temp) + 1, 1)
End If
Next
End If
Next
End Sub
Function Row_Bottom_Number(ws As Worksheet) As Long
' Найти последнюю строку с данными, непустую
Dim r As Range
Set r = ws.Cells.Find(what:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
If r Is Nothing Then
Row_Bottom_Number = 1
Else
Row_Bottom_Number = r.Row
End If
End Function