View Single Post
 
Old 12-20-2017, 07:45 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

I'm no pro either... just an old retired guy that plays with this stuff for entertainment when the trout aren't biting

Does this work? I'm guessing that by Null values you mean blank cells.
Code:
Dim rng As Range, cl As Range

Application.ScreenUpdating = False

With ActiveSheet
    Set rng = .Range("C5:C14")
    If WorksheetFunction.CountA(rng) = 0 Then Exit Sub
    .Unprotect Password:="jtls"
    For Each cl In rng
        cl.Resize(, 3) = Split(cl.Value, ";")
    Next cl
    For Each cl In rng.Resize(, 3)
        If cl = "" Then cl = 0
    Next cl
    .Protect Password:="jtls"
End With

Application.ScreenUpdating = True
Still not sure I understand things.
Don't know the layout of your sheet. Could be that there's 'stuff' below line 14 and that pasting in a csv of more than 10 rows would just screw things up.
I can limit things to 3 columns with code like above but have no idea as to how many lines the originating csv data is.

To my line of thinking, the most idiot proof way would be to paste the original csv data to a blank sheet, manipulate it there, text to columns (or adapt above), count of rows, etc. and deal with it from there, eventually copying the required 10 row by 3 column array to the C5:E14 target range.
Code:
.Range("C5:E14").value = SomeOtherSheet.Range("A1").resize(10,3).value
Reply With Quote