+ Reply to Thread
Results 1 to 6 of 6

Data Gathering VBA (basic)

  1. #1
    Registered User
    Join Date
    12-28-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    54

    Data Gathering VBA (basic)

    Hello,

    Would someone take a gander at the following VBA program and tell me where I'm going wrong. There are two strings one for "src" and one for "href". I can get them both working individually, but when I try to connect them to save space, I get a 'run time error'. Here is the code:

    Please Login or Register  to view this content.
    3rd line from the bottom, is where I get my error. Any help would be appreciated.

    CheerZ!
    Aaron
    Last edited by wyldjokre69; 08-28-2013 at 06:38 PM.

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Data Gathering VBA (basic)

    If InStr(the_url, Chr(34)) - 1) is 0 or false, it will error out.

    You'll have to test for false first

    Please Login or Register  to view this content.
    You'll have trouble at the loop test, too. Ampersand concatenates, while you probably want to add those together.

    Please Login or Register  to view this content.
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,246

    Re: Data Gathering VBA (basic)

    Hi,

    In your code of:
    If start_of_src & start_of_href > 0 Then

    I think this should fail. How about something like

    If start_of_src >0 AND start_of_href > 0 Then

    See what that does ..
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,762

    Re: Data Gathering VBA (basic)

    Your Mid functions probably won't work the way you expect them to either, because you are here again using "&". No idea what your intention is there.

    Please Login or Register  to view this content.
    Also, as a new user please take the time to read all the rules. There aren't very many and they are important:
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    12-28-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Data Gathering VBA (basic)

    Thanks Tinbendr, I will give your solution a try. Sorry for not following the rules of this forum. My bad.

    Quote Originally Posted by Tinbendr View Post
    If InStr(the_url, Chr(34)) - 1) is 0 or false, it will error out.

    You'll have to test for false first

    Please Login or Register  to view this content.
    You'll have trouble at the loop test, too. Ampersand concatenates, while you probably want to add those together.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-28-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: Data Gathering VBA (basic)

    Thank you Tinbendr, your suggestion worked, didn't have to put in false tho'. Thankx again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Gathering particular data
    By kishoremcp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-28-2012, 07:26 PM
  2. Web Data Gathering
    By Willis in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 11-09-2011, 01:07 PM
  3. gathering data?
    By ftahbaz@gmail.com in forum Excel General
    Replies: 2
    Last Post: 08-18-2006, 01:55 PM
  4. Gathering Data
    By Spreadsheet in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-13-2006, 11:10 PM
  5. gathering data
    By xak_tay in forum Excel General
    Replies: 0
    Last Post: 09-30-2005, 02:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1