I need assistance in identifying and removing what I will call a lingering (2nd back to back) Carriage Return and remove it.
Scenario: On an excel spread sheet I have a multiline cell that includes rows of data separated by Char(10) "alt enter"
Each row in the multiline cell has a date "01/01/2020" a space, a dash and dollar amount $7,000.00 and a Char(10) to separate it form the next row of data
In some cases toward the end of the sequence of data and new line appears that only includes the hidden carriage return.
Following is what the cell contains and how it is formatted.
7/1/2016 - $13,867.88
7/1/2017 - $14,214.57
7/1/2018 - $14,569.94
7/1/2019 - $14,934.18
7/1/2020 - $15,307.54
7/1/2021 - $17,000.00
alt enter
I read this data into an array (see below) and then read it back to textboxes on a user form (see image Below)
Private Sub CompleteMultipage1_6() 'Rent Schedule
Application.ScreenUpdating = False
' Col Z or 26 is Rent Schedule
Dim Rentschedule() As String
Dim r As Integer
With ShMasterTracker
Rentschedule() = Split(ShMasterTracker.Range(Colrntsch & Rnum).value, Chr(10))
For i = LBound(Rentschedule) To UBound(Rentschedule) '- 1
Controls("TbRentStrtDteYr" & i) = Split(Rentschedule(i))(0)
Controls("TBRentyr" & i) = Split(Rentschedule(i))(2)
Next i
'read array back to user form textboxes in image below
For i = LBound(Rentschedule) To UBound(Rentschedule) '+ 1
' ColCurMontent Col AA or 27 is current monthly rent
If Year(Split(Rentschedule(i))(0)) = Year(Date) And Month(Split(Rentschedule(i))(0)) <= Month(Date) Then
TBCurBaseRent = Split(Rentschedule(i))(2)
' ShMasterTracker.Range(ColCurMonRnt & Rnum).value =
Exit For
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Text boxes on a user form that data is read back into
It works perfectly until it runs into the last row in the cell in which there is no data and just an Alt Enter (Char(10)) (Linger Carriage return).
As the userform is implemented I need to identify these lingering carriage returns and remove them, not just work around them.
Any assistance with this would be appreciated.
T
hank you,
Scenario: On an excel spread sheet I have a multiline cell that includes rows of data separated by Char(10) "alt enter"
Each row in the multiline cell has a date "01/01/2020" a space, a dash and dollar amount $7,000.00 and a Char(10) to separate it form the next row of data
In some cases toward the end of the sequence of data and new line appears that only includes the hidden carriage return.
Following is what the cell contains and how it is formatted.
7/1/2016 - $13,867.88
7/1/2017 - $14,214.57
7/1/2018 - $14,569.94
7/1/2019 - $14,934.18
7/1/2020 - $15,307.54
7/1/2021 - $17,000.00
alt enter
I read this data into an array (see below) and then read it back to textboxes on a user form (see image Below)
Private Sub CompleteMultipage1_6() 'Rent Schedule
Application.ScreenUpdating = False
' Col Z or 26 is Rent Schedule
Dim Rentschedule() As String
Dim r As Integer
With ShMasterTracker
Rentschedule() = Split(ShMasterTracker.Range(Colrntsch & Rnum).value, Chr(10))
For i = LBound(Rentschedule) To UBound(Rentschedule) '- 1
Controls("TbRentStrtDteYr" & i) = Split(Rentschedule(i))(0)
Controls("TBRentyr" & i) = Split(Rentschedule(i))(2)
Next i
'read array back to user form textboxes in image below
For i = LBound(Rentschedule) To UBound(Rentschedule) '+ 1
' ColCurMontent Col AA or 27 is current monthly rent
If Year(Split(Rentschedule(i))(0)) = Year(Date) And Month(Split(Rentschedule(i))(0)) <= Month(Date) Then
TBCurBaseRent = Split(Rentschedule(i))(2)
' ShMasterTracker.Range(ColCurMonRnt & Rnum).value =
Exit For
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Text boxes on a user form that data is read back into
It works perfectly until it runs into the last row in the cell in which there is no data and just an Alt Enter (Char(10)) (Linger Carriage return).
As the userform is implemented I need to identify these lingering carriage returns and remove them, not just work around them.
Any assistance with this would be appreciated.
T
VBA Code: