Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Web Scraping With Loops

Hi,

I need some help & guidance please.

Although I can record a macro and make minor modifications with the
code, I know next to nothing about VBA programming. I am looking for a
simple macro (I hope) that would look into a specific sheet (called
main) that would contain a unique URL on each line that I would like
to inport into another spreadheet (called MAIN2). Each time it does
this, I would like it to add to column "Z" the URL that it pertains
to. Once done, it would once again go to main and look for the next
line that conatins yet another unique URL and then would return the
data back to the next available row etc etc.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Web Scraping With Loops

Are all of the unique URLs in a single column in Sheets("Main")?

If so, assume they are in column A. If they are in another column you
will neet to modify the code below:

Sub URLMain2()
Dim c As Range, lr As Long
lr = Sheets("Main").Cells(Rows.Count, 1).End(xlUp).Row
For Each c In Sheets("Main").Range("A2:A" & lr)
If Not c Is Nothing Then
c.Copy Sheets("Main2").Range("Z" & Cells(Rows.Count, 26) _
.End(xlUp).Row + 1)
End If
Next
End Sub


"qcan" wrote:

Hi,

I need some help & guidance please.

Although I can record a macro and make minor modifications with the
code, I know next to nothing about VBA programming. I am looking for a
simple macro (I hope) that would look into a specific sheet (called
main) that would contain a unique URL on each line that I would like
to inport into another spreadheet (called MAIN2). Each time it does
this, I would like it to add to column "Z" the URL that it pertains
to. Once done, it would once again go to main and look for the next
line that conatins yet another unique URL and then would return the
data back to the next available row etc etc.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Web Scraping With Loops

On Feb 25, 4:17*pm, JLGWhiz wrote:
Are all of the unique URLs in a single column in Sheets("Main")?

If so, assume they are in column A. *If they are in another column you
will neet to modify the code below:

Sub URLMain2()
Dim c As Range, lr As Long
* * * lr = Sheets("Main").Cells(Rows.Count, 1).End(xlUp).Row
* * * For Each c In Sheets("Main").Range("A2:A" & lr)
* * * * *If Not c Is Nothing Then
* * * * * * c.Copy Sheets("Main2").Range("Z" & Cells(Rows.Count, 26) _
* * * * * * * .End(xlUp).Row + 1)
* * * * *End If
* * * Next
End Sub



"qcan" wrote:
Hi,


I need some help & guidance please.


Although I can record a macro and make minor modifications with the
code, I know next to nothing about VBA programming. I am looking for a
simple macro (I hope) that would look into a specific sheet (called
main) that would contain a unique URL on each line that I would like
to inport into another spreadheet (called MAIN2). Each time it does
this, I would like it to add to column "Z" the URL that it pertains
to. Once done, it would once again go to main and look for the next
line that conatins yet another unique URL and then would return the
data back to the next available row etc etc.


Thanks.- Hide quoted text -


- Show quoted text -


Yes, your assumptions are correct. Unfortunatly, I got a runtime error
"9" when executing it (subscript out of range). The erro appear to be
on this line....

lr = Sheets("Main").Cells(Rows.Count, 1).End(xlUp).Row

Sorry... I am not sure how to fix this. Can you help ?

Thanks.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursively scraping web pages for embedded links and files Ker_01 Excel Programming 4 February 15th 08 09:19 PM
Scraping/listing document URLs on a server that don't have web pages/existing links? Keith R[_2_] Excel Programming 2 February 14th 08 04:29 AM
Web scraping mickbarry Excel Worksheet Functions 2 February 1st 06 10:20 AM
Web Screen Scraping scottymelloty[_19_] Excel Programming 0 November 29th 05 01:53 PM
scraping text from the active window geoffrey pritchard tillingsley Excel Programming 1 July 21st 03 12:45 AM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"