+ Reply to Thread
Results 1 to 6 of 6

If and go to

  1. #1
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    If and go to

    If H1 is empty, go to
    With Worksheets("Sheet1").QueryTables.Add(Connection:= _
    "URL;http://ichart.finance.yahoo.com/table.csv?s=" & _
    Worksheets("Sheet1").Range("J1").Value & "&a=10&b=13&c=2011&d=06&e=6&f=2013&g=w&ignore=.xlsx" _
    , Destination:=Worksheets("Sheet1").Range("$A$1"))
    If not empty, go to
    With Worksheets("Sheet1").QueryTables.Add(Connection:= _
    "URL;http://ichart.finance.yahoo.com/table.csv?s=" & _
    Worksheets("Sheet1").Range("J1").Value & "&a=10&b=13&c=2011&d=06&e=6&f=2013&g=m&ignore=.xlsx" _
    , Destination:=Worksheets("Sheet1").Range("$A$1"))
    Plse add code.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: If and go to

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: If and go to

    Thank you for your code.
    In J1, put ^dji
    at .Name = _
    compile error:
    Invalid or unqualified reference
    If Range("H1").Value = "" Then

    With Worksheets("Sheet1").QueryTables.Add(Connection:= _
    "URL;http://ichart.finance.yahoo.com/table.csv?s=" & _
    Worksheets("Sheet1").Range("J1").Value & "&a=10&b=13&c=2011&d=06&e=6&f=2013&g=w&ignore=.xlsx" _
    , Destination:=Worksheets("Sheet1").Range("$A$1"))
    else



    With Worksheets("Sheet1").QueryTables.Add(Connection:= _
    "URL;http://ichart.finance.yahoo.com/table.csv?s=" & _
    Worksheets("Sheet1").Range("J1").Value & "&a=10&b=13&c=2011&d=06&e=6&f=2013&g=m&ignore=.xlsx" _
    , Destination:=Worksheets("Sheet1").Range("$A$1"))
    End If[/code][/QUOTE]
    Last edited by asdzxc; 05-19-2012 at 10:38 PM.

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: If and go to

    Didn't add End With to your codes

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-25-2012
    Location
    Singa[pre
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: If and go to

    Thank you for your codes.
    compile error at (.Name = _):
    Invalid or ungualified reference

    Please Login or Register  to view this content.
    [/QUOTE]
    Thank you for your codes.
    compile error:
    Invalid or ungualified reference
    Please Login or Register  to view this content.
    Last edited by asdzxc; 05-20-2012 at 12:19 AM.

  6. #6
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: If and go to

    So you are having a problem with code that wasn't in the code that I gave you? Therefor you must have added, you must have had a reason to add it, you must have got it from somewhere; so perhaps you could bother yourself to tell us what you are up and not assume that we can read your mind.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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