LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Copy/Text To Columns/Transpose in VBA

If you're using xl2k or higher, you could use VBA's Split function.

Option Explicit
Sub testme()

Dim myArr As Variant
Dim myCell As Range

Set myCell = Worksheets("sheet1").Range("a1")

myArr = Split(Application.Trim(myCell.Value), " ")

myCell.Offset(0, 1).Resize(UBound(myArr) - LBound(myArr) + 1, 1).Value _
= Application.Transpose(myArr)

End Sub

There are different limits depending on what version of excel you're using.
xl2k has a limit of 5461(?) elements that can be passed to
application.transpose. xl2002+ doesn't have that restriction.

wrote:

Hi,

I have a string of numbers, each separated by a space, in a single
cell. I want to take that string, do a text-to-columns, and then
copy-paste special-transpose into a single column. I tried recording
this macro, but I have too many numbers and it will exceed the 256
column limit when I do text to columns. How can I do this through VBA?

Thanks!

Brett


--

Dave Peterson
 
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



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