Q
qcan
Hi All,
JLGWhiz was nice enough to make a small macro for me (see below) based
on a request a few days back. Unfortunatly, I am getting a runtime
error "9" when executing it (subscript out of range). The error
appears to be
on this line....
lr = Sheets("Main").Cells(Rows.Count, 1).End(xlUp).Row
I am not sure how to fix this. Can someone help out?
Much appreciated.
******************************************************
qcan View profileHi, 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.
More options Feb 25, 12:53 pm
Newsgroups: microsoft.public.excel.programming
From: qcan <[email protected]>
Date: Mon, 25 Feb 2008 09:53:17 -0800 (PST)
Local: Mon, Feb 25 2008 12:53 pm
Subject: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
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.
Reply Reply to author Forward
Cancel
Send Discard
From: qcan <[email protected]>
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Send Discard
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
JLGWhiz View profile
More options Feb 25, 4:17 pm
Newsgroups: microsoft.public.excel.programming
From: JLGWhiz <[email protected]>
Date: Mon, 25 Feb 2008 13:17:02 -0800
Local: Mon, Feb 25 2008 4:17 pm
Subject: RE: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
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
- Hide quoted text -
- Show quoted text -
Reply Reply to author Forward Rate this post:
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
qcan View profile
More options Feb 25, 5:26 pm
Newsgroups: microsoft.public.excel.programming
From: qcan <[email protected]>
Date: Mon, 25 Feb 2008 14:26:24 -0800 (PST)
Local: Mon, Feb 25 2008 5:26 pm
Subject: Re: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
On Feb 25, 4:17 pm, JLGWhiz <[email protected]>
wrote:
- 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.
JLGWhiz was nice enough to make a small macro for me (see below) based
on a request a few days back. Unfortunatly, I am getting a runtime
error "9" when executing it (subscript out of range). The error
appears to be
on this line....
lr = Sheets("Main").Cells(Rows.Count, 1).End(xlUp).Row
I am not sure how to fix this. Can someone help out?
Much appreciated.
******************************************************
qcan View profileHi, 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.
More options Feb 25, 12:53 pm
Newsgroups: microsoft.public.excel.programming
From: qcan <[email protected]>
Date: Mon, 25 Feb 2008 09:53:17 -0800 (PST)
Local: Mon, Feb 25 2008 12:53 pm
Subject: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
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.
Reply Reply to author Forward
Cancel
Send Discard
From: qcan <[email protected]>
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Send Discard
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
JLGWhiz View profile
More options Feb 25, 4:17 pm
Newsgroups: microsoft.public.excel.programming
From: JLGWhiz <[email protected]>
Date: Mon, 25 Feb 2008 13:17:02 -0800
Local: Mon, Feb 25 2008 4:17 pm
Subject: RE: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Report this message | Find messages by this author
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
- Hide quoted text -
- Show quoted text -
qcan said:
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.
Reply Reply to author Forward Rate this post:
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before
posting.
You do not have the permission required to post.
qcan View profile
More options Feb 25, 5:26 pm
Newsgroups: microsoft.public.excel.programming
From: qcan <[email protected]>
Date: Mon, 25 Feb 2008 14:26:24 -0800 (PST)
Local: Mon, Feb 25 2008 5:26 pm
Subject: Re: Web Scraping With Loops
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
On Feb 25, 4:17 pm, JLGWhiz <[email protected]>
wrote:
- Hide quoted text -
- Show quoted text -
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
- 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.