HomeTek
New Member
- Joined
- Jan 27, 2017
- Messages
- 42
- Office Version
- 365
- Platform
- Windows
This is probably a simple thing for many of you, but I can't figure it out.
I have an Active X Text Box which has a default size set. if the user enters more than 9 lines of data then the text box starts to increase size every time a new line of data is added.
Now this code is going to get extremely long if I keep manually adding extra lines, but I'm presuming there is a way to convert the below code into loop format?
Thanks
I have an Active X Text Box which has a default size set. if the user enters more than 9 lines of data then the text box starts to increase size every time a new line of data is added.
Now this code is going to get extremely long if I keep manually adding extra lines, but I'm presuming there is a way to convert the below code into loop format?
Thanks
Code:
Sub LineCount()
Select Case Sheets("Test Sheet").tbDetails.LineCount
Case 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Sheets("Test Sheet").tbDetails.Height = 110
Case 10
Sheets("Test Sheet").tbDetails.Height = 120
Case 11
Sheets("Test Sheet").tbDetails.Height = 130
Case 12
Sheets("Test Sheet").tbDetails.Height = 140
Case 13
Sheets("Test Sheet").tbDetails.Height = 150
Case 14
Sheets("Test Sheet").tbDetails.Height = 160
End Select
Sheets("Test Sheet").Range("A24").RowHeight = ActiveSheet.Shapes("tbDetails").Height + 10
End Sub