Copy paste csv to xlsx


I will place the vba code in suni.xlsm
my sheet name can be anything
my all file are in same place
Open the file
Completely Copy the first sheet data of anu.csv(here sheet name can be anything) and paste it to sheet1 of anu1.xlsx(here there can be data in anu1.xlsx if there is data then paste the data below that and if there is  no data then paste the data from starting)
close and save the workbook



Maybe there is a language barrier, but we are here to help - this is a free forum for all. You have been posting a lot of the same question and it looks like you are starting to get there, but you should not keep posting the same question over and over like this - it makes it harder to answer and, more important, it makes it so that a future reader cannot easily find the answer. I suggest you go to one of your older questions and edit them with your updated work and ask for help again there. But don't just add some vba code without any text, like you did when you "Answered" your own question in another thread.

C'mon man, we are trying to help you.
don (rep: 1745) Aug 31, '19 at 4:44 am
Ok, so I've been away for a few days or so with other work and now, reading through everything, realize that you lack basic forum/message-board etiquette - do not keep making new threads/questions when they are all for the same thing! Shape-up or the ban is coming!
don (rep: 1745) Aug 31, '19 at 4:58 am
 Dear Avinash. Once again you have failed to grasp the purpose of this site. We spoilt you with your first post by providing a solution to your query at some expenses - My solution would have cost you about $800 if you had to pay for it and you did not even use it. This site is not a free code provider but a forum to overcome any technical difficulties you may be having with your attempts code around a business process.  I would hope that you have realised by now that the use of excel vba macros to carry out data manipulation is a development process requiring a rudimentary understanding of data and logic. For example, if you were to open your csv file in a file editor like notepad++ (free and excellent) rather than excel you will see that it is a whole lot of records (lines) consisting of fields separated (traditionally) by commas. Although sometimes it may use a pipe character or a tab.
We won't mention UNIX files at this point but they are a whole other area of pain.
Looking at this post I suspect, with the absence of a business process necessitating the need to programmatically load a csv into excel I would suggest the built in file import process.
As I commented on your ver first post. Please show us what you have tried so far and we will be keen to forward your education and knowledge advancement. 
k1w1sm (rep: 197) Aug 31, '19 at 5:07 am
What's your question, avinash? Make sure that your "question" has a question mark. No question mark in your post means there is no question to answer, such as in this "question" of yours. Be reasonable, man. If you don't ask a question, don't expect an answer.
In this post you leave us guessing what your question might be. My guess is that your question would be, like, "Would someone [please omitted] write the code for me?" The answer is no. On this forum we can help you write the code yourself. You should start on your own and then perhaps ask for help. Hence k1's suggestion that you show what you have achieved on your own so far, and my own that you point to the problem you would like to solve.
Variatus (rep: 3553) Aug 31, '19 at 10:52 pm
Sorry Sir and Mam from next time this mistake will not be repeated 
Thnx Alot for giving ur Precious time and Great Support to this post
Have a Great Day
avinash (rep: 10) Sep 1, '19 at 12:49 am
Add to Discussion


Selected Answer
Sub test2()
    Dim cars As Range
    Dim csv As Range

    Set cars = Workbooks.Open(ThisWorkbook.Path & "\1.xls") _

    Set csv = Workbooks.Open(ThisWorkbook.Path & "\BasketOrder..csv") _

    csv.Cells(1).Insert xlDown
    Set csv = csv.Offset(-1).Resize(csv.Cells.Count + 1)

    cars.AdvancedFilter xlFilterInPlace, csv

    cars.Parent.Parent.Close True
    csv.Parent.Parent.Close False

End Sub

Problem Solved



Hay avinash
This is great. I would never have thought to open a CSV file with an  Excel object.
Could you explain what 
Set cars = Workbooks.Open(ThisWorkbook.Path & "\1.xls") _

is doing ?
Also when I run this the show all data fails is this correct ?

k1w1sm (rep: 197) Sep 1, '19 at 10:46 pm
Add to Discussion

Answer the Question

You must create an account to use the forum. Create an Account or Login