LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default working with strings

Yes, Excel97 doesn't have the Split function. Try this

Option Explicit

Sub Choose()
Dim sValues As String
Dim myString As String
Dim StringValues
Dim i As Long

sValues = _
"A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12"

StringValues = Split(sValues, ",")

For i = 0 To UBound(StringValues)

If Cells(i + 1, "A").Value < StringValues(i) Then
Cells(i + 1, "A").EntireRow.Insert
End If

Next i

End Sub

#If VBA6 Then
#Else
'-----------------------------------------------------------------
Function Split(Text As String, _
Optional Delimiter As String = ",") As Variant
'-----------------------------------------------------------------
Dim i As Long
Dim sFormula As String
Dim aryEval
Dim aryValues

If Delimiter = vbNullChar Then
Delimiter = Chr(7)
Text = Replace(Text, vbNullChar, Delimiter)
End If
sFormula = "{""" & Application.Substitute(Text, Delimiter, """,""") &
"""}"
aryEval = Evaluate(sFormula)
ReDim aryValues(0 To UBound(aryEval) - 1)
For i = 0 To UBound(aryValues)
aryValues(i) = aryEval(i + 1)
Next

Split = aryValues

End Function
#End If



--

HTH

RP
(remove nothere from the email address if mailing direct)


"DaSo" wrote in message
...
Hi Bob,

yes I have Excel 97, so I guess thatīs the problem?

Dan


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




 
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
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Working with Strings joe Excel Discussion (Misc queries) 2 March 8th 06 08:47 PM
How to find number of pairs of strings from list of strings? greg_overholt Excel Worksheet Functions 5 January 27th 06 10:42 PM
Working with strings Ron Rosenfeld Excel Programming 0 July 30th 03 08:34 PM
Working with strings Andrew Lenczycki Excel Programming 0 July 30th 03 04:02 PM


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