LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How can I program a 'roll' of text, eg ABCD - BCDA.

this only accepts a positive number to roll

Public Function RollText(sStr As String, num As Long)
Dim i As Long, j As Long, k As Long
Dim sStr1 As String
k = Len(sStr)
j = 1 + num Mod k
For i = 1 To Len(sStr)
If j k Then j = 1
sStr1 = sStr1 & Mid(sStr, j, 1)
j = j + 1
Next
RollText = sStr1
End Function

=rolltext("ABCD",1)
would give BCDA

this doesn't loop:

Public Function RollText1(sStr As String, num As Long)
Dim i As Long, j As Long, k As Long
Dim sStr1 As String
k = Len(sStr)
j = 1 + num Mod k
sStr1 = Right(sStr, k - j + 1) & Left(sStr, j - 1)
RollText1 = sStr1
End Function

--
Regards,
Tom Ogilvy

"Jonny JetSet" <Jonny wrote in message
...
Please Help!!!

I would like to use a spreadsheet to program a 'roll' of text.

Examples: ABCD to roll to BCDA and ABCD to roll toCDAB.

I am using Microsoft Office 2003 - Excel 2003.




 
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 fill alphabets in a series like abcd insted of 1234 abhijit date Excel Discussion (Misc queries) 1 December 22nd 06 01:05 PM
Pareto's Law and ABCD ranking of items nander Excel Discussion (Misc queries) 2 February 19th 06 07:47 PM
IsPossible to rename header ABCD row? rtf500 New Users to Excel 3 January 8th 06 12:24 PM
Convert letters into numbers. i.e. ABCD = 52 Rhapsody 1234 Excel Worksheet Functions 8 December 9th 05 07:33 PM
text box program jeff Excel Programming 1 April 7th 04 10:26 PM


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