Results 1 to 3 of 3

Creating a table with VBA using lastrow as range

Threaded View

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    Newmarket, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    10

    Creating a table with VBA using lastrow as range

    I need to create a table in VBA for several thosand rows of data, however only with 3 columns. I need to run this daily, however the problem lies in the fact that Column A and Column B will vary in length each day, one day A will be longer, and the next the day B could be the longest, so I cant select the last row of a specific column, I need the last row of A:C

    this is what I am currently using, however it is bugging out,


    Sub CreateTable()
    Dim lastRow As Long
    
        Range("A:C" & lastRow).Select
        ActiveSheet.ListObjects.Add(xlSrcRange, Range("a:c" & lastRow), , xlYes).Name = _
            "Table9"
        Range("Table9[#All]").Select
    End Sub

    Any help is appreciated, thanks!
    Last edited by washout; 03-28-2013 at 11:15 AM.

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