Put the code in a procedure with parameters:
Private Sub TestChar(range1 as Range, range2 As Range, range3 As Range)
Dim strText As String
Dim CutOff As Integer, Lgth As Integer
'Your old CombineCells module
range1 = range1 & " " & range2
range2 = ""
'Your old TestChar module
strText = Range("b29") '.Text
CutOff = 1024
Lgth = Len(strText)
If Len(strText) >= CutOff And range2 = "" Then
Do Until Mid(strText, CutOff, 1) = " "
CutOff = CutOff + 1
Loop
range2.Formula = Right(strText, Lgth - CutOff)
range3 = "See Additional Comments Section"
range1 = Left(strText, CutOff)
End If
End sub
Now you can call the same code easily from another module
Sub MasterCalling()
TestChar "B29", "B444", "B35"
TestChar "C29", "C444", "C35"
TestChar "D29", "D444", "D35"
TestChar "E29", "E444", "E35"
TestChar "F29", "F444", "F35"
Main Topics
Browse All Topics





by: heer2351Posted on 2004-02-19 at 13:28:09ID: 10406683
Hmm all hard coded cell references in your code that is not the way you should deal with this. Code might be improved as well, could you please give a short functional description of what you want and why you need it.