Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Reading/Disassembling a String of information

The code below gathers numbers from a set range and then consolidates
them to one cell:
E F G ... V
1 No 3 ... 1,No,3,...

Sub StrgGen()
Set nana = Range("E12:T12")
Range("V12").ClearContents
increment = 1
For Each c1 In nana
If increment = 1 Then
Range("V12").Value = c1.Value
increment = 2
Else
Range("V12").Value = Range("V12").Value & "," & c1.Value
End If
Next c1
End Sub

I am curious to know if there is a way to disassemble the generated
string. The values of the cells are not restricted and thus the
string will vary in length. Does anyone have any solutions? Any help
will be greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
XP XP is offline
external usenet poster
 
Posts: 389
Default Reading/Disassembling a String of information

Hi,

Open the Visual Basic Editor, type SPLIT, place your cursor anywhere in the
word and press F1.

Also do the same for JOIN.

These are very useful commands for working with strings and they make it
much easier to read in and write out strings stored in memory.

Hope this helps.

"mastermind" wrote:

The code below gathers numbers from a set range and then consolidates
them to one cell:
E F G ... V
1 No 3 ... 1,No,3,...

Sub StrgGen()
Set nana = Range("E12:T12")
Range("V12").ClearContents
increment = 1
For Each c1 In nana
If increment = 1 Then
Range("V12").Value = c1.Value
increment = 2
Else
Range("V12").Value = Range("V12").Value & "," & c1.Value
End If
Next c1
End Sub

I am curious to know if there is a way to disassemble the generated
string. The values of the cells are not restricted and thus the
string will vary in length. Does anyone have any solutions? Any help
will be greatly appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Reading/Disassembling a String of information

Thank you for the information, but I still need some help. I don't
really know what to put in the expression segment of the code. Do you
think that you could give me an example. Using the criteria given in
the initial problem statement.

Split(0, "," , -1) = Range("T13:E13")

Is what I tried and it doesn't work, probably for obvious reasons, but
if you could help me out with an example or further explaination that
would be great. Thank you.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Reading/Disassembling a String of information

First off, Split is a function and, as such, operates on something... you
can't assign anything to it. Second, it takes a single String argument and
produces an array with each element of the array containing the text
occurring between the delimiters, so you would want to give it V13 to
operate on, no E13:T13. Third, you didn't tell us what you wanted to do with
the disassembled values. Here is some code which will put the disassembled
information on Row 25 starting in Column A...

Sub Test()
Dim X As Long
Dim Parts() As String
Parts = Split(Range("V13").Value, ",")
For X = 0 To UBound(Parts)
Range("A25").Offset(0, X).Value = Parts(X)
Next
End Sub

Rick


"mastermind" wrote in message
...
Thank you for the information, but I still need some help. I don't
really know what to put in the expression segment of the code. Do you
think that you could give me an example. Using the criteria given in
the initial problem statement.

Split(0, "," , -1) = Range("T13:E13")

Is what I tried and it doesn't work, probably for obvious reasons, but
if you could help me out with an example or further explaination that
would be great. Thank you.


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
retrieve information from clipboards not in the reading pane JodieLeeGarcia Excel Discussion (Misc queries) 0 June 23rd 09 09:19 PM
Newbie: Reading color information [email protected] Excel Programming 2 November 7th 06 11:20 AM
Reading information from a closed workbook yhockman1 Excel Programming 2 March 15th 06 01:25 PM
Reading the Clipboard Source Information TCook Excel Programming 0 October 9th 05 04:49 AM
Reading information from all workbooks in a folder... H. Rye Excel Programming 2 January 2nd 04 02:55 PM


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