Option Explicit
Public Function sNewPupil(prRange As Range, psWise As String) As String
' constants
Const ksRowWise = "R"
Const ksColWise = "C"
' declarations
Dim I As Integer, J As Integer, I1 As Integer, J1 As Integer, A As String, B As String
' start
A = ""
' process
With prRange
Select Case psWise
Case ksRowWise
I1 = .Rows.Count
J1 = .Columns.Count
Case ksColWise
I1 = .Columns.Count
J1 = .Rows.Count
End Select
For I = 1 To I1
For J = 1 To J1
Select Case psWise
Case ksRowWise
B = prRange.Cells(I, J).Value
Case ksColWise
B = prRange.Cells(J, I).Value
End Select
Debug.Print B;
A = A & B
Next J
Next I
Debug.Print
End With
' end
sNewPupil = A
End Function