Results 1 to 7 of 7

Select and copying a variably sized range and add data to a table

Threaded View

Masun Select and copying a variably... 02-11-2013, 05:07 AM
AB33 Re: Select and copying a... 02-11-2013, 10:18 AM
Masun Re: Select and copying a... 02-11-2013, 10:42 AM
AB33 Re: Select and copying a... 02-11-2013, 11:41 AM
Masun Re: Select and copying a... 02-11-2013, 11:51 AM
AB33 Re: Select and copying a... 02-11-2013, 11:58 AM
Masun Re: Select and copying a... 02-11-2013, 01:37 PM
  1. #1
    Forum Contributor
    Join Date
    01-11-2013
    Location
    Sweden
    MS-Off Ver
    MS 365
    Posts
    188

    Select and copying a variably sized range and add data to a table

    Hi!

    I have 2 sheets, one is a table (you know, when you push the button the rows get different colors and autofilter is placed in the top.), I have that table as a data source to some pivot tables (in the file im uploading this sheet is named "DataTabell"). The other sheet is some kind of raw data, that is "Utdata".

    I got a lot of help with the code that takes data from sheet "Utdata" and places it in the first empty row in sheet "Datatable". This works perfectly, the macro is constructed so it always takes data in sheet Utdata from A4 : ??. I dont know how many rows or columns there are from time to time in the sheet "Utdata". This macro handles the data correctly:

    Sub Kopiera_utdata_1()
          
        Dim LastRow As Long, LastColumn As Long
        Sheets("Utdata").Select
        LastRow = Sheets("Utdata").Range("A3").End(xlDown).Row
        LastColumn = Cells.Find(What:="*", After:=Range("A1"), SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
        Range(Range("A4"), Cells(LastRow, LastColumn)).Copy Sheets("DataTabell").Range("A64000").End(xlUp).Offset(1, 0)
        
    'End Sub
    It probably should be mentioned that the data in "Utdata" always has some "rubbish" in the end of it. Look att row 576 in sheet "Utdata", there the rubbish starts. In the file uploaded, the range that needs to be moved to sheet "DataTabell" is A4:AH573, but his can, as earlier sad, vary from time to time.

    The problem now is that the data that is being taken from sheet "Utdata" and placed in first empty row in sheet "DataTabell" is not being automatically added to the table in sheet "DataTabell". Usually when you have a table and put something in the first empty row below it, its being part of the table automatically. Now the data is added in the correct place but it is not added so it becomes part of the table. First 199 rows in sheet "DataTabell" is a table, if I run the macro the data from sheet "Utdata" is placed beginning on row 200 but will not be apart of the table...

    Hope someone can help me and that I made myself understood, if not; please ask again and I will try to explain more.

    /Masun
    Attached Files Attached Files

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