Function GetCompanyNameNew(r As Range) As Variant s_left = InStr(1, r, Chr(10), vbTextCompare) s_right = InStr(s_left + 1, r, Chr(10), vbTextCompare) If s_left = 0 Then GetCompanyNameNew = r Else GetCompanyNameNew = Mid(r, 1, s_left - 1) End If End Function Function GetCompanyNameNewRRRRR(r As Range) If r = 51 Then GetCompanyNameNewRRRRR = GetCompanyNameNew(Range("D" & r.Row)) Else GetCompanyNameNewRRRRR = GetCompanyNameNew(Range("C" & r.Row)) End If End Function 'Заполняем данные по контрагентам (оч быстро) Sub sdsdsdsd() For i = 6 To Cells.SpecialCells(xlLastCell).Row Select Case Range("E" & i).Value Case 55.03: Range("J" & i) = "Депозит (размещение) " & Trim(Range("K" & i).Value) GoTo Nexti Case 57.02: Range("J" & i) = "Конвертация валюты" GoTo Nexti Case 58.03: Range("J" & i) = "Выдача кредита (займа)" GoTo Nexti Case 62.01: Range("J" & i) = "Возврат ДС" GoTo Nexti Case 68 To 69.99: Range("J" & i) = "Налоги" GoTo Nexti Case 70: Range("J" & i) = "Зарплата" GoTo Nexti Case 91 To 91.9: Range("J" & i) = "РКО" GoTo Nexti End Select Select Case Range("G" & i).Value Case 55.03: Range("J" & i) = "Депозит (изъял) " & Trim(Range("K" & i).Value) GoTo Nexti Case 57.02: Range("J" & i) = "Конвертация валюты" GoTo Nexti Case 58.03: Range("J" & i) = "Выдача кредита (займа)" GoTo Nexti Case 60 To 60.9: Range("J" & i) = "Возврат ДС от поставщика" GoTo Nexti Case 66 To 67.9: Range("J" & i) = "Получение кредита от " & Trim(Range("K" & i).Value) GoTo Nexti Case 68 To 69.99: Range("J" & i) = "Налоги" GoTo Nexti Case 70: Range("J" & i) = "Зарплата" GoTo Nexti Case 91 To 91.9: Range("J" & i) = "РКО" GoTo Nexti End Select If Range("E" & i).Value = 51 Then Range("J" & i) = GetCompanyNameNew(Range("D" & i)) Else Range("J" & i) = GetCompanyNameNew(Range("C" & i)) End If Nexti: Next i End Sub
2 комментария к “Получить данные после знака новой строки Chr(10)”