Hey
Ive placed it it the code
Option Explicit Sub Port() Dim sht1 As Worksheet Dim qryTbl As QueryTable Dim XRow As Variant Dim Nrow As String Set sht1 = ThisWorkbook.Worksheets("Here") For Each XRow In Range("B2", Cells(Rows.Count, 2).End(xlUp))' it replaces this bit Nrow = XRow.Address Set qryTbl = sht1.QueryTables.Add(Connection:="URL;" & XRow, _ Destination:=sht1.Range("A1")) With qryTbl .BackgroundQuery = True .WebSelectionType = xlSpecifiedTables .WebTables = "1,3" .WebFormatting = xlWebFormattingAll .Refresh BackgroundQuery:=False .SaveData = True End With With sht1 .Range("C1").Copy Destination:=Sheets("links").Range(Nrow).Offset(0, 1) .Range("B7").Copy Destination:=Sheets("links").Range(Nrow).Offset(0, 2) End With Sheets("Here").Select Cells.Select Selection.Delete Shift:=xlUp Sheets("links").Select Next XRow End Sub
regards pike
If the solution helped please donate here to the RSPCA
Sites worth visiting;
J&R Solutions - royUK
AJP Excel Information - Andy Pope
Spreadsheet Toolbox
VBA for smarties - snb
HI,
this makro is very time consuming. does anyone know how to speed up this process? maybe to use just one worksheet, instead of two would help a bit...
maybe someone has any better ideas. I appreciate any advise or update in the code.
THANKS![]()
Last edited by afgi; 10-19-2010 at 10:44 AM.
sub snb() sq=application.transpose(columns(2).specialcells(2)) With ThisWorkbook.sheets("Here") For j=2 to ubound(sq) If .querytables.count=0 then With .QueryTables.Add("URL;" & sq(1),.[A1]) .WebSelectionType = xlSpecifiedTables .WebTables = "1,3" .WebFormatting = xlWebFormattingAll .Refresh False .SaveData = True End With else With .querytables(1) .connectionstring=sq(j) .refresh False End with End if Do Doevents Loop until .[C1]<>"" Sheets("links").Range(j).Offset(0, 1)=.[C1] Sheets("links").Range(j).Offset(0, 2)=.[B7] .[C1].clearcontents End With Next End Sub
Dear Snb,
I get an error on "End with", so it does not work for me... thanks for any feedback
No objection to your analysing the code and fixing this error.
Move the "Next" above the "end with"
Dear Snb,
could you pls attache your file you are workin on. it really does not work on my computer. I doubt it is because of language or different region
Dear Romperstomper,
it suspends on yours
I was just saying that those two lines were in the wrong order. I make no comment about the functionality of the code itself.
hi,
so do you have any idea why it is not working in my excel?? thanks for any help in advance![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks