Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent help!!!! VBA

If the cell(1,1) has data of several lines
eg:
Hello World
Hello World
Hello World
Hello World
Hello World

How can I split this data into several rows using VBA?

The steps to do the same manually are
1. Select the data in cell(1,1)
2. Cut it
3. select cell(2,1) and select back cell(1,1)( to resize the cell1)
4. Paste the data in the buffer and excel automatically pastes each
line into a different row.

How do I perform the same using VBA, if I try to record the actions
described above , excel is not recording any statements for steps 1 and
2.

I appreciate any help..


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Urgent help!!!! VBA

Problem with recording these steps is that steps 1 and 2 are done in Edit
mode. VBA macro will not record or work while in Edit Mode.

You could record splitting the data into 5 columns using the Text to Columns
Wizard then transposing to a column.

Line-break character(other) in Text Wizard De-limiter is usually ALT + 010 on
Numpad.

Hang in there. One of the VBA gurus will be along with something easier and
more elegant.

Gord Dibben Excel MVP

On Thu, 11 Dec 2003 18:40:47 -0600, pswarna
wrote:

If the cell(1,1) has data of several lines
eg:
Hello World
Hello World
Hello World
Hello World
Hello World

How can I split this data into several rows using VBA?

The steps to do the same manually are
1. Select the data in cell(1,1)
2. Cut it
3. select cell(2,1) and select back cell(1,1)( to resize the cell1)
4. Paste the data in the buffer and excel automatically pastes each
line into a different row.

How do I perform the same using VBA, if I try to record the actions
described above , excel is not recording any statements for steps 1 and
2.

I appreciate any help..


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Urgent help!!!! VBA

On Thu, 11 Dec 2003 18:40:47 -0600, pswarna
wrote:

If the cell(1,1) has data of several lines
eg:
Hello World
Hello World
Hello World
Hello World
Hello World

How can I split this data into several rows using VBA?

The steps to do the same manually are
1. Select the data in cell(1,1)
2. Cut it
3. select cell(2,1) and select back cell(1,1)( to resize the cell1)
4. Paste the data in the buffer and excel automatically pastes each
line into a different row.

How do I perform the same using VBA, if I try to record the actions
described above , excel is not recording any statements for steps 1 and
2.

I appreciate any help..



Assuming there is a Line Feed between each Hello World (as there is in your
post), and also if you have a later version of VBA, then the following VBA
routine will work:

========================
Option Explicit
Sub SplitCell()
Dim temp As Variant
Dim i As Integer

temp = Split(Cells(1, 1), vbLf)

For i = 0 To UBound(temp)
Cells(i + 1, 1) = temp(i)
Next i
End Sub
====================



---
Message posted from http://www.ExcelForum.com/


--ron
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
IME MODE FOR EXCEL 2007 (URGENT URGENT) Stella Wong Excel Discussion (Misc queries) 1 August 23rd 08 11:16 PM
Urgent-Urgent VBA LOOP Jeff Excel Discussion (Misc queries) 0 October 6th 05 05:46 PM
not urgent Gary's Student Excel Discussion (Misc queries) 2 August 17th 05 01:03 PM
Macro help urgent urgent Dave Peterson[_3_] Excel Programming 0 September 4th 03 03:59 PM
Macro help urgent urgent chandra Excel Programming 0 September 4th 03 03:50 PM


All times are GMT +1. The time now is 09:46 AM.

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

About Us

"It's about Microsoft Excel"