Pessoal, boa tarde.
Preciso de uma ajuda para finalizar minha macro. Ela esta quase pronta.
A planilha deverá funcionar assim:
- Copio o primeiro link da coluna G2;
- Coleto os dados da Web utilizando este link do pedido;
- Jogo estes dados no Excel;
- Busco o telefone, copio o telefone e colo na coluna H2;
- Busco o e-mail, copio o e-mail e colo na coluna I2;
- Repito o processo agora para a G3 colando na H3 e I3
- Repito o processo para as próximas linhas até o final da planilha.
Este meu código ja funciona, mas quero que ele entenda como o processo acima:
Sub Macro3()
'
' Macro3 Macro
'
'
Range("G2").Select
ActiveCell.FormulaR1C1 = "http://venusbela.loja2.com.br/cart/3246132"
Range("H2").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://venusbela.loja2.com.br/cart/3246132", Destination:=Range("$N$1"))
.Name = "3246132"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Cells.Find(What:="telefone:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
Selection.Copy
Range("H2").Select
ActiveSheet.Paste
Cells.Find(What:="E-mail:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
Selection.Copy
Range("I2").Select
ActiveSheet.Paste
Columns("N:Q").Select
Application.CutCopyMode = False
Selection.QueryTable.Delete
Selection.ClearContents
Range("G3").Select
ActiveCell.FormulaR1C1 = "http://venusbela.loja2.com.br/cart/3246132"
Range("H3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://venusbela.loja2.com.br/cart/3240332", Destination:=Range("$N$1"))
.Name = "3240332"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Cells.Find(What:="telefone:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
Selection.Copy
Range("H3").Select
ActiveSheet.Paste
Cells.Find(What:="E-mail:", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, 1).Select
Selection.Copy
Range("I3").Select
ActiveSheet.Paste
Columns("N:Q").Select
Application.CutCopyMode = False
Selection.QueryTable.Delete
Selection.ClearContents
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("I1").Select
End Sub
Postado : 27/09/2017 10:28 am