Amigos, segue meu código abaixo. O mesmo está com um problema que eu não consegui enxergar.
Vou correndo a macro passo-a-passo com o F8 e quando depois que ela abre um relatório auxiliar:
Workbooks.Open Filename:= _
"Y:marketingGerênciaRelatórios GerenciaisRelatório Gerencial_Julho2013.xlsm" _
, Notify:=False
A macro que estava indo passo-a-passo ela roda toda até o final, depois que abre esse relatório.
Isso já aconteceu antes, mas eu lembro de ter achado algum erro no código. Dessa vez não estou encontrando.
Muito obrigado!
Sub click() Dim cont As Integer Dim ultimalinha As Integer Dim wb1 As Workbook Dim wb2 As Workbook Dim ultimalinhawb1 As Integer Dim ultimalinhaassunto As Integer Dim Ano, Mes, Dia, data As String Dim aba(1 To 4) As Variant aba(1) = "Americanas.com" aba(2) = "Shoptime" aba(3) = "Sou Barato" aba(4) = "Submarino" Set wb1 = ActiveWorkbook datainicio = Cells(1, 5).Value [b]Workbooks.Open Filename:= _ "Y:marketingGerênciaRelatórios GerenciaisRelatório Gerencial_Julho2013.xlsm" _ , Notify:=False[/b] 'Depois daqui ela vai embora até o final da macro Set wb2 = ActiveWorkbook wb2.Sheets("Apoio").Select b = Cells(17, 2).Value ''''DEFININDO PRIMEIRA LINHA E ÚLTIMA LINHA DO REL GER'''''''''''''''''' Sheets("AOC").Select ultimalinhawb2 = Cells(Rows.Count, 2).End(xlUp).Row cont = 1 Do While Cells(cont, 2).Value <> b cont = cont + 1 Loop primeiralinhawb2 = cont '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' For i = 1 To 4 wb1.Activate wb1.Sheets(i).Select a = Sheets(i).Cells(1, 4).Value category = Sheets(i).Cells(1, 6).Value cont = 1 Do While wb1.Sheets(i).Cells(cont, 2).Value <> datainicio cont = cont + 1 Loop primeiralinhawb1 = cont ultimalinhawb1 = Cells(Rows.Count, 2).End(xlUp).Row For h = primeiralinhawb1 To ultimalinhawb1 For g = primeiralinhawb2 To ultimalinhawb2 For j = 1 To 4 wb2.Activate Sheets(aba(j)).Select categorywb2 = Cells(2, 4).Value If category = categorywb2 And wb2.Sheets(j).Cells(g, 2).Value = wb1.Sheets(i).Cells(h, 2) Then wb1.Sheets(i).Cells(h, 4).Value = wb2.Sheets(j).Cells(g, 3).Value wb1.Sheets(i).Cells(h, 7).Value = wb2.Sheets(j).Cells(g, 4).Value wb1.Sheets(i).Cells(h, 9).Value = wb2.Sheets(j).Cells(g, 6).Value End If Next j Next g Next h Next i End Sub
Boa tarde!!
Qual é o problema?
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Rodo a macro com o F8, e apartir da abertura do arquivo auxiliar ela roda por completo, sendo que eu queria que ela rodasse passo -a-passo.
Somente pelo código, fica dificílimo duplicarmos o que reportou.
Pode disponibilizar seu modelo/exemplo (dados/nomes e valores substitua por fictícios) assim podemos tentar acompanhar/analisar o que acontece
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel