Results 1 to 10 of 10

Display data horizontally not vertically through VBA

Threaded View

  1. #1
    Registered User
    Join Date
    10-22-2015
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    5

    Display data horizontally not vertically through VBA

    Hi,

    I have built a macro which loops through data from one sheet ("Sheet1") to build a URL (it's an API for the web analytics tool Webtrends). The macro then loads data from the API into a new sheet "display". Each dataset has the same 4 headers: Time Period, Page, Title, Page Views.

    My issue is that the looped data is being displayed along columns (horizontally), but I need the data to display row after row (vertically).

    The result I want is just 4 columns being filled with hundreds of rows of data, as opposed to hundreds of columns being filled with just a couple of rows of data. Transposing seems to just paste everything under one column.

    Here is my code:

    Sub ConcatTest()
    
    Dim rCell As Range
    
    For Each rCell In Sheet1.Range("F2", Sheet1.Cells(Sheet1.Rows.Count, "F").End(xlUp))
    
    With Sheets("display").QueryTables.Add(Connection:= _
    "URL;https://ws.webtrends.com/v3/Reporting/profiles/17716/reports/oOEWQj3sUo6/?totals=all&start_period=" & rCell & "&measures=1&format=html&suppress_error_codes=true", _
             Destination:=Worksheets("display").Range("A1").End(xlUp)(2, 1))
             
    
    .BackgroundQuery = True
    
    .TablesOnlyFromHTML = True
    
    .Refresh BackgroundQuery:=False
    
    .SaveData = True
    
    End With
    
    Next rCell
    
    End Sub
    Can any body see why in this code my data is looping through columns as opposed through rows?

    Thanks in advance!
    Last edited by Leith Ross; 10-22-2015 at 12:57 PM. Reason: Changed Color Tags to Code Tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] transpose and consolidate data horizontally to vertically
    By Excel_learner in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-04-2014, 03:50 PM
  2. [SOLVED] listbox display vertically and not horizontally
    By Blackbeginnings in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2013, 07:03 PM
  3. Replies: 5
    Last Post: 01-27-2013, 09:36 PM
  4. Excel 2007 : Merging data horizontally vs. vertically
    By enhydra in forum Excel General
    Replies: 4
    Last Post: 12-12-2010, 06:16 PM
  5. UDF to Display Results Vertically Instead of One Cell Horizontally
    By snake10 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2008, 12:18 PM
  6. Replies: 2
    Last Post: 02-14-2005, 01:48 AM
  7. A tough one! line up vertically/horizontally through data
    By djvice in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2005, 04:32 PM

Tags for this Thread

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