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 excel vba : how to split characters in text file into cells?

Hi

I need some opinions. I got a text file loaded into a text box
and a combo box which has several integer values.
When a user choose a value from the combo box, e.g. 3,
I want to be able to group the characters from the text file
into 3 characters where each cell consists of one character.

The sample of the text file looks like this:
WUBEFIQLZURMVOFEHMYMWTIXCGTMPIFKRZUPMVOIRQMMWOZM

And when the user choose the number from the combo box,e.g. 3
I want the cell to contain:


W U B
E F I
Q L Z
U R M
V O F
and so forth

I have this line of codes but I wander if there's a better way of doin
it?

Private Sub KeyLengthComboBox_Change()
Worksheets("Sheet9").Activate
Dim myChar
keylength = CInt(KeyLengthComboBox)

For k = 1 To CipherTextBox.TextLength
myChar = Mid(CipherTextBox.Text, k, 1)
If k Mod keylength = 0 Then
Worksheets("sheet9").Cells(Int(k / keylength), keylength)
myChar
Else
Worksheets("sheet9").Cells(Int(k / keylength) + 1, k Mo
keylength) = myChar
End If
Next k

End Sub

Many thanks
did

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

 
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
Split text file into Excel sheet and separate the final results intoa new sheet Luciano Paulino da Silva Excel Worksheet Functions 8 April 18th 09 02:00 AM
Split text to multiple cells Lauren H Excel Worksheet Functions 4 July 2nd 07 02:51 PM
split text into separate cells jtaiariol Excel Worksheet Functions 7 May 7th 07 09:32 PM
Can text in one cell be split into several cells? Mistie Excel Discussion (Misc queries) 9 September 10th 06 03:53 AM
text cells end page how split to next. Text lost! Elaine Excel Discussion (Misc queries) 1 August 28th 05 05:48 PM


All times are GMT +1. The time now is 08:11 PM.

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"