
Originally Posted by
p45cal
Also the .Height of a cell is not always the same as its .rowheight.
You might have to go about setting the textbox height to Range("A356:A375").Height and even then the textbox bottom isn't always in line with the bottom cell if you look at it at different zoom levels.
As suggested, I've added the a new line "ActiveSheet.Shapes("TextBox 2").Height = Range("A356:A375").RowHeight * 20" in the macro to set the textbox height to Range("A356:A375").Height. And yes, you are right, even then the textbox bottom isn't always in line with the bottom cell.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Overall Observation
If Target.Cells.Count = 1 And IsEmpty(Target) Or Not IsEmpty(Target) Then
If ActiveSheet.Shapes("TextBox 2").Height < 171 Then
Let ActiveSheet.Shapes("TextBox 2").Height = 171
Range("A356:A375").RowHeight = ActiveSheet.Shapes("TextBox 2").Height / 20
ActiveSheet.Shapes("TextBox 2").Height = Range("A356:A375").RowHeight * 20
Else
Range("A356:A375").RowHeight = ActiveSheet.Shapes("TextBox 2").Height / 20
ActiveSheet.Shapes("TextBox 2").Height = Range("A356:A375").RowHeight * 20
End If
End If
End Sub
So, do I lose hope???
Bookmarks