R
R
Ruslan Kirichenko2020-02-22 13:25:55
excel
Ruslan Kirichenko, 2020-02-22 13:25:55

How to display minus in a table?

Hello guys who fumbles well in excel? How to display minus in a table?
There is a table of goods there there are prices, in plus and minus - that's just all the minuses should be displayed on a separate sheet. Well, what if you cut out 1 sheet and 5 lines and transferred it to a separate sheet, but if there are 100 sheets of 200 lines, you won’t cut each line? Please help... In excel, I'm a complete noob so I decided to study it.

Here is an example in the photo: Where red are prices with a minus sign. This is how they should be taken out.5e51019ae2cfb311238061.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pychev Anatoly, 2020-02-22
@timka92

Enable Filter.
Filter by negative values ​​in the desired column.
Select all (Ctrl-A), copy and paste on the desired sheet
Repeat for all sheets
Or write a macro if this is a periodic task

N
nektopme, 2020-02-27
@nektopme

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question