+ Reply to Thread
Results 1 to 3 of 3

Copy data from one variable range (column) from 1st sheet to paste and append on Sheet 2

  1. #1
    Registered User
    Join Date
    12-12-2013
    Location
    Fort Myers
    MS-Off Ver
    2010
    Posts
    2

    Red face Copy data from one variable range (column) from 1st sheet to paste and append on Sheet 2

    Hello,
    I am totally new at VB and I am trying to copy and paste a list from column H, that will grow and that is called OutletsCanada, from sheet "align" to paste in column A of "Sheet1" under existing data - that will not be the same lenght neither.
    In each sheet, there is an array that is called:
    OutletsCanada in align - using an OFFSET formula
    stores in Sheet1 - using an OFFSET formula This list is the list to be appended with data from "align".

    Once the data are pasted under the existing data in column A, I have to drag down the formulas in columns B to G till the end of this list - that represents the cumulated data.

    Here is what I got but it doesn't work, it says that the list is empty... The code I got is from parts I picked-up from Internet... THANK YOU SO MUCH FOR YOUR HELP!!!


    Sub GetOutletsAndCanada()
    Dim rng1 As Range
    Dim rng2 As Range


    Set rng1 = Sheets("align").Range("OutletsCanada")
    Set rng2 = Sheets("Sheet1").Range("stores")


    Sheets("align").Activate
    Sheets("align").Select
    ActiveSheet.Range("OutletsCanada").Copy
    Sheets("Sheet1").Select
    Sheets("Sheet1").Activate
    ActiveSheet.Range("stores").End(xltodown).Offset(1, 0).Select
    ActiveSheet.Paste
    Range("B42:G42").Select
    Application.CutCopyMode = False
    Selection.AutoFill Destination:=Range("B42:G200")
    Range("B42:G300").Select
    Range("A43:G43").Select
    Selection.Delete Shift:=xlUp





    End Sub

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Copy data from one variable range (column) from 1st sheet to paste and append on Sheet

    Welcome to the forum.

    We'd like to help you but first..

    Pls take some minutes to read forum rules and specially-in this case- rule#3
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    12-12-2013
    Location
    Fort Myers
    MS-Off Ver
    2010
    Posts
    2

    Re: Copy data from one variable range (column) from 1st sheet to paste and append on Sheet

    Hello,
    Thank you for your very quick answer and SORRY for not getting back earlier.
    I tried all the solutions that you gave me but none of them worked. I do something wrong and don't know what it is.


    Sub GetOutletsAndCanada()
    Dim nextrow As Long

    'here it would define next row where to paste the data. It is done via the array "stores" that defined in xls.'
    nextrow = Worksheets("Sheet1").Cells(Rows.Count, "stores").End(xlUp).Row + 1

    'I assumed I had to select and activate the worksheet to select the range "OutletsCanada" - the range from the sheet "align"'
    Worksheets("align").Select
    Worksheets("align").Activate
    Worksheets("align").Range("OutletsCanada").Copy

    'same here, I thought I had to select/activate the sheet "Sheet1" to be able to paste the date from align.'
    Worksheets("Sheet1").Select
    Worksheets("Sheet1").Activate
    Worksheets("Sheet1").Range("stores" & nextrow).Paste


    End Sub
    'I forgot to say it gives me an error 1004... Thank you!
    Last edited by Catheri; 01-22-2014 at 05:40 PM.

+ 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. [SOLVED] Copy variable range from sheet to the last row with a specific blank column in new sheet
    By seputus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2012, 07:29 PM
  2. Copy Range from one sheet, and paste it to the next available column on another sheet
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2012, 04:01 PM
  3. Replies: 1
    Last Post: 07-17-2012, 11:05 PM
  4. [SOLVED] Select file, Copy Worksheet Range and Append onto 1 Sheet
    By Tellm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2012, 03:27 PM
  5. Append variable range of data to the bottom of another sheet
    By crockee in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2010, 09:48 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