+ Reply to Thread
Results 1 to 11 of 11

Paste data from array - question

  1. #1
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105

    Paste data from array - question

    Hi,

    I'm placing data from an input sheet in an array.
    I paste 3 columns from this array on another sheet:
    Column 1,2,3 and I use the 6th column to place a figure.

    Only disadvantage is that there is already data on the 'paste' sheet in column 4 and 5.

    Macro and example attached.
    thx
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-10-2021
    Location
    Paryzevo
    MS-Off Ver
    2k3
    Posts
    60

    Re: Paste data from array - question


    so ... where is this question and what does it concern ?

  3. #3
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105
    Quote Originally Posted by mjr veverka View Post

    so ... where is this question and what does it concern ?

    Sorry if I was unclear…
    If I read the case, I understand your confusion 🙈

    I’ll try to explain:
    Example:
    I have a 6 column ‘temp’ array which I paste the 6th column in a range (column H).
    But if I do this the data in Column F on my sheet is gone.

    More info in the excel attached

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Paste data from array - question

    You have an "Input" sheet with data in Columns A to K except Column I which is a blank Column
    You have a "5km | Djun" sheet with Columns A to T that need data except Columns E and R that are blank Columns
    Which Columns of your "Input" sheet do you want copied to your "5km | Djun" and into which Column should that be pasted?
    As an example: Column A to Column A, Column C to Column B, Column F to Column D etc etc.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,380

    Re: Paste data from array - question

    I'm placing data from an input sheet in an array.
    I would populate two arrays. One with columns 1 to 3, and the second with column 6. Then paste them separately where you want them without overwriting columns 4 and 5.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Paste data from array - question

    Further to Post #4.

    Please Login or Register  to view this content.
    In your attachment, it looks like Column F in "5km | Djun" has the data from Column A in "Input".
    If so, change the 7 in arrInputCol to a 1.

    You can add, delete and/or change the numbers in arrInputCol and in arrOutputCol as needed.
    Make sure that both have the same amount of entries.
    The numbers in arrInputCol are the Column numbers from "Input" and the numbers in arrOutputCol are the Column numbers from "5km | Djun".
    As it stands now, data from Column1 goes into Column 1, Column3 goes into Column 2, Column 4 into Column 3, Column 6 into Column 4 and Column 7 into Column 6.

  7. #7
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105

    Re: Paste data from array - question

    Hi jolivanes,

    This almost does the trick.
    One question:

    The data pasted in the 6th column on the "5km | Djun" sheet is no data which is present in the "Input" sheet.
    It's just that the first person receives 500 points, the second 499, third 498 ...

    How can I implement this in the code?
    thx

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Paste data from array - question

    May I ask why you are searching for Name when you are clearing everything beforehand?
    Please Login or Register  to view this content.
    And why are you looping the Data when you are just overwriting everything anyway...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  9. #9
    Forum Contributor
    Join Date
    02-13-2017
    Location
    Belgium
    MS-Off Ver
    O365
    Posts
    105

    Re: Paste data from array - question

    Hi,

    Just a simple version of my actual code to highlight my problem.
    I’m copying data from one sheet to another.

    If the name is already there, give appropriate points.
    If he’s not there, copy name and give points.

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: Paste data from array - question

    Probeer dit eens. Try this.
    Please Login or Register  to view this content.

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: Paste data from array - question

    This dos what your initial code does excluding the clear of column F
    Please Login or Register  to view this content.
    If Input sheet is continuously updating then why not make use of Sheet event Code on completion of entry...No need to loop everything...
    So as is...why is your code clearing the entries on 5km sheet...Should that not be the case...
    If it is and the data must remain...what is the numbering sequence then if exists and if new data is added...

    Perhaps you should upload a sample file with existing data and result and then new data and expected result...
    Attached Files Attached Files
    Last edited by sintek; 10-09-2021 at 01:15 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. How to store values of multiple cells in an array and paste that array data into one
    By Christina M in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2021, 12:41 AM
  2. [SOLVED] Copy/Paste Array Data into Row Cells
    By Hawk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-03-2016, 05:42 PM
  3. How to paste into range one col of data from Multi Col Array
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-11-2014, 08:04 AM
  4. Add multiple ranges to an array then paste the data
    By ttd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-09-2014, 04:58 PM
  5. [SOLVED] Array formula question regarding summing data from two separate sheets
    By lilsnoop in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-10-2013, 09:38 PM
  6. [SOLVED] Quick Array question - Copy array to another array then resize?
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-02-2013, 01:17 AM
  7. [SOLVED] Question About IF/THEN with Data Validation AND multiple cell data paste
    By erynatpitt in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-10-2012, 03:57 PM

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