Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Importing multiline records files into Excel cells

Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 145
Default Importing multiline records files into Excel cells

We do not understand your requirements :
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

but believe it can be done quite easily

"michaelp" wrote in message
...
Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Importing multiline records files into Excel cells

I'm confused about what Line-shifts are, but...

If you import all your data into column A, then maybe you can run a macro that
would essentially do a bunch of copy|pastespecial transpose.

If you want to try:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim myBigRng As Range
Dim myArea As Range

Set wks = ActiveSheet

With wks
With .Range("a:a")
.Cells.Replace What:="^", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False
End With

Set myBigRng = Nothing
On Error Resume Next
Set myBigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If myBigRng Is Nothing Then
MsgBox "Nothing found in column A"
Exit Sub
End If

For Each myArea In myBigRng.Areas
myArea.Copy
myArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
Next myArea

On Error Resume Next
.Range("b:b").Cells.SpecialCells(xlCellTypeBlanks) .EntireRow.Delete
On Error GoTo 0
End With
End Sub


michaelp wrote:

Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Importing multiline records files into Excel cells

On 27.10.2006 16:30, Dave Peterson wrote:
I'm confused about what Line-shifts are, but...


I understand that the confusion was caused by me writing
....
* to be imported into its own cell (say column A)


I mean that each record would occupy a signle cell (row, if you like) in
column A. Clumsily expressed. Sorry.

If you import all your data into column A, then maybe you can run a macro that
would essentially do a bunch of copy|pastespecial transpose.

If you want to try:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim myBigRng As Range
Dim myArea As Range

Set wks = ActiveSheet

With wks
With .Range("a:a")
.Cells.Replace What:="^", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False
End With

Set myBigRng = Nothing
On Error Resume Next
Set myBigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If myBigRng Is Nothing Then
MsgBox "Nothing found in column A"
Exit Sub
End If

For Each myArea In myBigRng.Areas
myArea.Copy
myArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
Next myArea

On Error Resume Next
.Range("b:b").Cells.SpecialCells(xlCellTypeBlanks) .EntireRow.Delete
On Error GoTo 0
End With
End Sub


michaelp wrote:
Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Importing multiline records files into Excel cells

Do you really want each record to be in a single cell in column A or do you want
each record to be a single row--where each column would be a separate field.

You may want to try the macro to see if it works ok.

michaelp wrote:

On 27.10.2006 16:30, Dave Peterson wrote:
I'm confused about what Line-shifts are, but...


I understand that the confusion was caused by me writing
....
* to be imported into its own cell (say column A)


I mean that each record would occupy a signle cell (row, if you like) in
column A. Clumsily expressed. Sorry.

If you import all your data into column A, then maybe you can run a macro that
would essentially do a bunch of copy|pastespecial transpose.

If you want to try:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim myBigRng As Range
Dim myArea As Range

Set wks = ActiveSheet

With wks
With .Range("a:a")
.Cells.Replace What:="^", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False
End With

Set myBigRng = Nothing
On Error Resume Next
Set myBigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If myBigRng Is Nothing Then
MsgBox "Nothing found in column A"
Exit Sub
End If

For Each myArea In myBigRng.Areas
myArea.Copy
myArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
Next myArea

On Error Resume Next
.Range("b:b").Cells.SpecialCells(xlCellTypeBlanks) .EntireRow.Delete
On Error GoTo 0
End With
End Sub


michaelp wrote:
Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael



--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Importing multiline records files into Excel cells

Dave,
I had a similar issue with a text file as michaelp and wanted to let
you know that the code you provided worked perfectly the first
time....I'm now going to go buy a lottery ticket! I had no idea how to
start and thought I would 'google' it first and found your post. Thank
you so much for contributing and keep up the good work.

I hope you have as great a day as mine has started.

Take Care
Mike C


Dave Peterson wrote:
Do you really want each record to be in a single cell in column A or do you want
each record to be a single row--where each column would be a separate field.

You may want to try the macro to see if it works ok.

michaelp wrote:

On 27.10.2006 16:30, Dave Peterson wrote:
I'm confused about what Line-shifts are, but...


I understand that the confusion was caused by me writing
....
* to be imported into its own cell (say column A)


I mean that each record would occupy a signle cell (row, if you like) in
column A. Clumsily expressed. Sorry.

If you import all your data into column A, then maybe you can run a macro that
would essentially do a bunch of copy|pastespecial transpose.

If you want to try:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim myBigRng As Range
Dim myArea As Range

Set wks = ActiveSheet

With wks
With .Range("a:a")
.Cells.Replace What:="^", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False
End With

Set myBigRng = Nothing
On Error Resume Next
Set myBigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If myBigRng Is Nothing Then
MsgBox "Nothing found in column A"
Exit Sub
End If

For Each myArea In myBigRng.Areas
myArea.Copy
myArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
Next myArea

On Error Resume Next
.Range("b:b").Cells.SpecialCells(xlCellTypeBlanks) .EntireRow.Delete
On Error GoTo 0
End With
End Sub


michaelp wrote:
Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael


--

Dave Peterson


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Importing multiline records files into Excel cells

Google is a good friend! <vbg.

Glad it helped.

wrote:

Dave,
I had a similar issue with a text file as michaelp and wanted to let
you know that the code you provided worked perfectly the first
time....I'm now going to go buy a lottery ticket! I had no idea how to
start and thought I would 'google' it first and found your post. Thank
you so much for contributing and keep up the good work.

I hope you have as great a day as mine has started.

Take Care
Mike C

Dave Peterson wrote:
Do you really want each record to be in a single cell in column A or do you want
each record to be a single row--where each column would be a separate field.

You may want to try the macro to see if it works ok.

michaelp wrote:

On 27.10.2006 16:30, Dave Peterson wrote:
I'm confused about what Line-shifts are, but...

I understand that the confusion was caused by me writing
....
* to be imported into its own cell (say column A)

I mean that each record would occupy a signle cell (row, if you like) in
column A. Clumsily expressed. Sorry.

If you import all your data into column A, then maybe you can run a macro that
would essentially do a bunch of copy|pastespecial transpose.

If you want to try:

Option Explicit
Sub testme01()

Dim wks As Worksheet
Dim myBigRng As Range
Dim myArea As Range

Set wks = ActiveSheet

With wks
With .Range("a:a")
.Cells.Replace What:="^", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
MatchCase:=False
End With

Set myBigRng = Nothing
On Error Resume Next
Set myBigRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) _
.Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If myBigRng Is Nothing Then
MsgBox "Nothing found in column A"
Exit Sub
End If

For Each myArea In myBigRng.Areas
myArea.Copy
myArea.Cells(1).Offset(0, 1).PasteSpecial Transpose:=True
Next myArea

On Error Resume Next
.Range("b:b").Cells.SpecialCells(xlCellTypeBlanks) .EntireRow.Delete
On Error GoTo 0
End With
End Sub


michaelp wrote:
Hello!

I have a text file with many records, each record spans several lines.
Records are delimited with a ^ character (the delimiter occupies a
line). Two consecutive records:

*000nam 2200121 4500
*0011170018nno
*008030813 no sme
*0411 $hger
*100 $aLuther, Martin
*2401 $aDer kleine Katechismus
*2451 $aDr. Morten Luther ucceb katekismusas
*260 $aKristianiast$bGröndahl$c1837
*300 $a87 s.$bport.$c12 cm
^
*000nam 2200157 4500
*0011170064nno
*008051109 no sme
*100 $aStockfleth, N.V.$d1787-1866
*2451 $aAbes ja låkkam-girje
*260 $aKristianiast$bGröndahl$c1837
*300 $a48 s.
*500 $aSkrevet av N.V. Stockfleth
*653 $aABC
*900 $aStockfleth, Niels J. Chr. V.$zStockfleth, N.V.
*900 $aStockfleth, Nils Vibe$zStockfleth, N.V.
^

It is thousands of records, And I would like to remove several hundreds
of them, based on inspecting the records. Time consuming, but no other
way to do it (entirely intellectual).

I would like to do this in Excel instead of in a text editor, and would
like each record
* to be imported into its own cell (say column A)
* line-shifts kept within the cell (eases inspection)

I have so far not found a way to accomplish the former - excel imports
each text-line into its own row.

Any ideas / pointers?

Gratitude

Michael


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating only non-empty cells... Jay Excel Worksheet Functions 9 September 22nd 06 03:20 AM
Importing CSV files into Excel Doug Excel Discussion (Misc queries) 9 August 24th 05 08:22 PM
Help importing text files into individual cells saybut Excel Discussion (Misc queries) 4 May 31st 05 03:24 PM
Importing text files to Excel with big numbers Orjan Excel Worksheet Functions 0 March 17th 05 07:13 PM
sharing/using/saving Excel 2002 files in Excel 2003 maze2009 Excel Discussion (Misc queries) 0 January 20th 05 07:27 PM


All times are GMT +1. The time now is 04:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"