LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to split a cell into multiple rows

I have an interesting issue. I'm working with a Lotus Notes Database
that I'm trying to extract data from. I'm using Crystal Reports and
NotesSQL to drop the necessary data to excel. The issue is that Lotus
stores multiple lines of data in one field, separated by a line break
(chr(10)). I would like to write a macro that could break the data in
this column out into separate rows whenever a line break is found. I
was then planning to use ASAP Utilities' fill blanks macro to populate
any empty cells.

I've tried to do this on my own based on what I've read in this forum,
but have not had much success. What I have so far is:

Public Sub separatecells()
Dim s As String, s1 As String, s2 As String
Dim iloc As Long
s = ActiveCell.Value
iloc = InStr(1, s, Chr(10), vbTextCompare)
If iloc < 0 Then
s1 = Trim(Left(s, iloc - 2))
s2 = Trim(Right(s, Len(s) - iloc))
ActiveCell.Offset(0, 0) = s1
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
ActiveCell.Offset(0, 0) = s2
Else
ActiveCell.Offset(0, 0).Value = s
End If
End Sub

This does not loop through the selected cells because I'm having
issues with my loop because of IF statement. I could provide a sample
file if someone would like to help but needs additional information.
Any assistance would be greatly appreciated!!!!
 
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
how to split one cell into multiple rows? wondering Excel Discussion (Misc queries) 2 April 3rd 23 10:55 AM
Split rows into multiple sheet if..... Stuart[_3_] Excel Programming 1 April 26th 07 04:29 PM
How do I split a cell into multiple rows/columns? SKA Excel Discussion (Misc queries) 1 January 18th 06 12:04 AM
Can I split up an excel spreadsheet into multiple files by rows? seespot Excel Discussion (Misc queries) 8 December 21st 05 10:14 PM
Split Cell Into Seperate Rows Andibevan[_4_] Excel Programming 2 December 20th 05 06:35 PM


All times are GMT +1. The time now is 04:45 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"