Excel freaks needed

PsiFox

Prefers Mac over PC any day
Messages
7,240
Name
Mark
Edit My Images
Yes
Anyone got an method of importing a csv file into a pre defined excel spreadsheet?

Thanks
 
I thought the standard import function would let you import the data to specified cells in an existing worksheet ?
 
If you are trying to import to a specified area in a worksheet, you could import the file to a blank worksheet and use formuale to copy the relevant info to specified cells?
 
I thought the standard import function would let you import the data to specified cells in an existing worksheet ?

apparently not with a .csv into a template

If you are trying to import to a specified area in a worksheet, you could import the file to a blank worksheet and use formuale to copy the relevant info to specified cells?

That might be the way it has to go thanks.
 
That would have been my suggestion too.

And :razz: I resent being labeled a freak ;)

Ah but you see by using "freak" I narrowed it down to the most intelligent members of the forum that were likely to give me an answer:D

So a compliment really:clap:
 
How about using a User Defined Function... I've used this before.

Paste this into new/existing module or in the worksheet code

Code:
Public Function SplitLine(strLine As String, strDelim As String, lngCol As Long) As Variant 

    Dim p1 As String 
    Dim al() As String 
    
    
    p1 = Trim(strLine) 
    a1 = Split(strLine, strDelim, -1) 
      
    SplitLine = Trim(a1(lngCol)) 
    

End Function

And then call it from the spreadsheet with the CSV lines in extract individual elements

For example - this will give you element 3 from the line at A2

=SplitLine(A2,",",2)

Hope that makes sense :shrug:
 
How about using a User Defined Function... I've used this before.

Paste this into new/existing module or in the worksheet code

Code:
Public Function SplitLine(strLine As String, strDelim As String, lngCol As Long) As Variant 

    Dim p1 As String 
    Dim al() As String 
    
    
    p1 = Trim(strLine) 
    a1 = Split(strLine, strDelim, -1) 
      
    SplitLine = Trim(a1(lngCol)) 
    

End Function

And then call it from the spreadsheet with the CSV lines in extract individual elements

For example - this will give you element 3 from the line at A2

=SplitLine(A2,",",2)

Hope that makes sense :shrug:

Nope doesn't make sense to me. Will read it several time to check:)

My knowledge goes about as far as, adding up a column and dispalying the result in another cell.
 
Anyone got an method of importing a csv file into a pre defined excel spreadsheet?

Thanks

Is the import data laid out the same as the original spreadsheet?

I would import the data into a blank spreadsheet first just to check whether the spreadsheet formats the same.

As its a csv file, that should import no problems, open excel and then open the file, import wizard should appear. You csv file either has columns of data separated by spaces (fixed width) or separated by a comma (delimited), <next> choose you delimiters comma, semicolon or other etc <next> then view your data before pressing finish.
 
Nope doesn't make sense to me. Will read it several time to check:)

My knowledge goes about as far as, adding up a column and dispalying the result in another cell.

Ok, sorry, I was afraid of that :D

I think pete.rush idea is nice and simple
 
Back
Top