Extrair dados de uma planilha para outra com base em um critério

mmaob

New Member
Joined
Jan 19, 2017
Messages
1
[FONT=&quot]Boa dia[/FONT]
[FONT=&quot]Pessoal[/FONT]

[FONT=Lucida Grande, Trebuchet MS, Verdana, Helvetica, Arial, sans-serif]Sou novato com a criação de Macros, alguém pode me ajudar, criei a macro, mas ela não esta apagando, a planilha solicitada, vocês poderiam ver o que esta acontecendo, por favor, e como criar um botão para executar a macro, segue anexo do arquivo, e para finalizar a versão do Excel é 2016, tenho que colocar em um computador que a versão é 2003 e desconfigura tudo que fiz...[/FONT]

<dl class="codebox" style="margin-right: 0px; margin-left: 0px; padding: 3px; border: 1px solid rgb(203, 214, 208); color: rgb(51, 51, 51); font-family: "Lucida Grande", "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;"><dd style="margin: 0px; padding: 0px;"><code style="margin: 2px 0px; padding: 5px 0px 0px; overflow: auto; display: block; height: auto; max-height: 200px; font-stretch: normal; font-size: 0.9em; font-family: Monaco, "Andale Mono", "Courier New", Courier, mono; line-height: 1.3em; color: rgb(46, 139, 87);">Planilha4.Range("A8:F500").ClearComments
ultimalinha = Planilha1.Cells(Rows.Count, "a").End(xlUp).Row
lin = 8
For i = 8 To ultimalinha
If Planilha1.Cells(i, 6) < 5 Then
Planilha4.Cells(lin, 1) = Planilha1.Cells(i, 1)
Planilha4.Cells(lin, 2) = Planilha1.Cells(i, 2)
Planilha4.Cells(lin, 3) = Planilha1.Cells(i, 3)
Planilha4.Cells(lin, 4) = Planilha1.Cells(i, 4)
Planilha4.Cells(lin, 5) = Planilha1.Cells(i, 5)
Planilha4.Cells(lin, 6) = Planilha1.Cells(i, 6)
lin = lin + 1
End If
Next
End Sub</code></dd></dl>[FONT=&quot]Grato,[/FONT]

[FONT=&quot]Mario Augusto de Oliveira[/FONT]
[FONT=&quot]MMAOB[/FONT]
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi and welcome to the MrExcel Message Board.

Sorry, i do not speak Portuguese. :(

However, my guess would be that you need to use:
Code:
Planilha4.Range("A8:F500").ClearContents
and not Planilha4.Range("A8:F500").ClearComments.

ClearContents will empty the cells of data.
ClearComments will remove any cell Comments that you may have added.

This link tells you about Comments: https://www.extendoffice.com/documents/excel/720-excel-show-hide-comments.html


Regards,
 
Upvote 0
Oi Mario

Tente explicar precisamente o que você está tentando fazer.
Procure também nos mostrar uma pequena amostra dos seus dados - umas 10 linhas são suficientes.
Seria bom mostrar os dados antes de rodar a macro e depois com os resultados desejados.

Vou tentar ajudar.

Abraços

M.
 
Upvote 0

Forum statistics

Threads
1,214,647
Messages
6,120,722
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top