ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable text manipulation (https://www.excelbanter.com/excel-programming/401925-variable-text-manipulation.html)

[email protected]

Variable text manipulation
 
Whats the easiest way to do this I am having a hard time trying to
figure this one out :( Please Help!!!

Private Function CheckedSummons(StringtoCheck As String)
Dim cnt As Integer
Dim NewText As String
Dim SummonsInformation as String
For cnt = 25 To 41
NewText = Range("A6:AX4500").Find(StringtoCheck,
LookIn:=xlValues).Offset(0, cnt)
If NewText < "" Then
' If Newtext is not nothing then Save Whats Already in
SummonsInformation, Add a NewLine
' and Add Newtext to SummonsInformation
end if
next cnt

End Function

Bernie Deitrick

Variable text manipulation
 
Private Function CheckedSummons(StringtoCheck As String) As String
Dim cnt As Integer
Dim NewText As String
Dim SummonsInformation As String
Dim rngFound As Range

Set rngFound = Range("A6:AX4500").Find(StringtoCheck, _
LookIn:=xlValues)

For cnt = 25 To 41
NewText = rngFound.Offset(0, cnt).Value
If NewText < "" Then
If SummonsInformation = "" Then
SummonsInformation = NewText
Else
SummonsInformation = SummonsInformation & vbLf & NewText
End If
End If
Next cnt

CheckedSummons = SummonsInformation

End Function

HTH,
Bernie
MS Excel MVP


wrote in message
...
Whats the easiest way to do this I am having a hard time trying to
figure this one out :( Please Help!!!

Private Function CheckedSummons(StringtoCheck As String)
Dim cnt As Integer
Dim NewText As String
Dim SummonsInformation as String
For cnt = 25 To 41
NewText = Range("A6:AX4500").Find(StringtoCheck,
LookIn:=xlValues).Offset(0, cnt)
If NewText < "" Then
' If Newtext is not nothing then Save Whats Already in
SummonsInformation, Add a NewLine
' and Add Newtext to SummonsInformation
end if
next cnt

End Function





All times are GMT +1. The time now is 01:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com