+ Reply to Thread
Results 1 to 13 of 13

Problems with Pasting data from an .csv-file into an .xlsm-file

  1. #1
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Problems with Pasting data from an .csv-file into an .xlsm-file

    Hi all,

    I have a problem that I cannot understand:

    1. First I manually copy either the whole sheet, or only whole columns A:C from a .csv-file (don't think it matters if I copy from a .csv-file or .xlsm-file here, I probably get the same problem)

    2. I go to an already open .xlsm-file and press a button to run some code;
    The code first creates a new sheet and gives it the name “tempSheet”.
    Then, in this new sheet the code are supposed to paste the copied data, starting from cell “A1”, but I get an error doing just that!

    I’ve tried using Activesheet.Paste, Sheets("tempSheet").Range("A1").PasteSpecial xlPasteValues and other combinations, but I don’t get it to work.

    How do I paste this, so that it really works every time?

    Please, help!

    Kind regards
    /lassebasse

  2. #2
    Forum Contributor
    Join Date
    12-03-2014
    Location
    India
    MS-Off Ver
    2016 .......
    Posts
    390

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    Post your code..... to better understand the question

  3. #3
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    Yes post the code. is the temp sheet in the file containing the code or the file containing the data?

  4. #4
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    Hi,

    The "tempSheet" is in the file containing the code!

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,210

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    where do you copy the data in the code?

  6. #6
    Forum Contributor
    Join Date
    12-03-2014
    Location
    India
    MS-Off Ver
    2016 .......
    Posts
    390

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    You manually copying the data / sheet from csv & run the code for pasting that information ..... its not possible.

  7. #7
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    1. First I manually copy either the whole sheet, or only whole columns A:C from a .csv-file (don't think it matters if I copy from a .csv-file or .xlsm-file here, I probably get the same problem)

    I copy the data (3 columns or whole sheet) from another file and via code want to paste it in the main file.
    Why isn't it possible? Is it because I first create a new sheet ("tempSheet") to paste it in?

  8. #8
    Forum Contributor
    Join Date
    12-03-2014
    Location
    India
    MS-Off Ver
    2016 .......
    Posts
    390

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    I hope this is as per the understanding issue....
    It will refresh the data too.

    Please Login or Register  to view this content.

    Good Luck
    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!!!
    Last edited by sanjuss2; 01-19-2019 at 06:41 AM.

  9. #9
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    I’m sure this is a good way to do it, if the .csv-file was saved to begin with.
    (The .csv-file is genererated from a program as a temporary report, i.e. not saved,just open.)

    Can anyone explain why it doesn’t work in my simple way?

    How come I cannot just copy columns/sheet from an open (not saved) .csv-file and easily paste the data into an .xlsm-fil?

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    Perhaps a segment of this video, beginning at the 24:15 mark, will help to explain as well as provide a possible solution (since you have the subscription version of Excel).
    https://www.bing.com/videos/search?q...5411&FORM=VIRE
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  11. #11
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    Hi JeteMc,

    Thanks for the tip.
    As I understand this video I would need to install “Power Query” which I’m not at all familiar with …

    The .csv-file is a report downloaded from another system, and it’s just open, not saved, when I copy data (columns A:C or whole sheet) from it.
    I would first need to save the .csv-file, to be able to import it, but that’s is a step I’d rather avoid.

    But, would importing the .csv-file, instead of copy/pasting it, be the solution?
    What I still don’t understand is that if I copy/paste manually it works great, but if I manually copy data from .csv-file and then start the code to paste it, it doesn’t work at all?!


    (I’m doing this in Excel 2010, at work (Excel 365 is at home), which means some difficulties installing things only on just my version.

  12. #12
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,535

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    The 365 version should already have Power Query at the left end of the Data tab ribbon (it is called Get & Transform Data), however I don't think that you can use it with the 2010 version. VBA is not something that I have enough experience with to be able to help further. I wish you the best.

  13. #13
    Registered User
    Join Date
    12-10-2012
    Location
    Sweden
    MS-Off Ver
    Excel 2010/Excel 365
    Posts
    26

    Re: Problems with Pasting data from an .csv-file into an .xlsm-file

    JeteMc:
    Ok, I'll look into that about Power Query/Get & Transform Data.

    Thank you!

+ 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. Import .xls file into .xlsm file and delete unwanted headings, blank rows.
    By pacificepoc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-05-2018, 12:50 AM
  2. [SOLVED] Import data from .XLS, xlsx file into .xlsm file and do vlookup
    By pacificepoc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2018, 01:32 AM
  3. Pasting values from column in xlsm to txt file
    By Szwadron6 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-17-2017, 09:29 AM
  4. [SOLVED] How to export from xlsm file to xls but original file must stay in xlsm(vba script)
    By martin81 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-03-2016, 09:51 AM
  5. Data from closed xlsm file without defined file path???
    By dbrizor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2015, 07:27 AM
  6. Replies: 3
    Last Post: 05-21-2013, 08:22 AM
  7. Save file xls file as xlsm - macro won't run in xlsm workbook
    By captbluefin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2012, 11:39 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