___ ___ erkimt Search for items that are in within a given month of the year ______ qstntxt ___

I need to mount a macro for a spreadsheet I'm working on. I have a table with several columns in the %code% tab (in the date column there are several dates with day month and year type "22/02/2018), and I needed a macro to, when typing a month and year (" 02/2018 ") in a cell in the billing tab, copy the rows whose date cell is within this month.

I do not need to copy the whole line, just certain columns that I will determine as needed.

    
______azszpr300707___

Your code will be something similar to the one below. Change the columns of the %code% object to the columns you want.

Note: I put two dates: one for the first day of the month and one for the last one, to mark the interval. Then you will either want to enter two dates instead of one month.

%pre%     

___
0

I need to mount a macro for a spreadsheet I'm working on. I have a table with several columns in the ordem tab (in the date column there are several dates with day month and year type "22/02/2018), and I needed a macro to, when typing a month and year (" 02/2018 ") in a cell in the billing tab, copy the rows whose date cell is within this month.

I do not need to copy the whole line, just certain columns that I will determine as needed.

    
asked by anonymous 16.05.2018 / 17:59

1 answer

0

Your code will be something similar to the one below. Change the columns of the sheets(A).cells(linha,coluna) object to the columns you want.

Note: I put two dates: one for the first day of the month and one for the last one, to mark the interval. Then you will either want to enter two dates instead of one month.

sub exemplo()
dim data_inicio as date, data_fim as date
dim linha as double
data_inicio = sheets("faturamento").cells(1,3).value
data_fim = sheets("faturamento").cells(1,4).value
linha_ordem= 'número da 1ª linha da tabela de ordens

do
    if sheets("ordem").cells(linha_ordem,"coluna das datas").value>=data_inicio and sheets("ordem").cells(linha_ordem,"coluna das datas")<=data_fim then
        sheets("faturamento").cells(linha_faturamento,"coluna destino").value = sheets("ordem").cells(linha_ordem, "coluna a ser copiada").value
        linha_faturamento = linha_faturamento + 1
    end if
    linha_ordem = linha_ordem + 1
loop until sheets("ordem").cells(linha_ordem,"coluna das datas").value=""
end sub
    
21.05.2018 / 20:15