View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Sharing workbooks limitations - Merged Cells

On Monday, February 10, 2014 11:17:22 PM UTC-8, Claus Busch wrote:
Hi Howard,



Am Mon, 10 Feb 2014 16:56:40 -0800 (PST) schrieb L. Howard:



Would you still be able to add comments to the selection or would the textbox/label prevent that?




if you insert a textbox or a label you can't select the cell behind. So

it is impossible to add a comment. you can place the comment in a cell

in front or behind the selection.





Regards

Claus B.

--


After playing around with text boxes, I was coming to that conclusion.

I found this code that does an excellent job of filling a selection neatly with a text box.

I have a couple of other codes that add a predetermined text to the text box (Which would be a name in this case) and color but I cannot incorporate those methods into this preferred code.

One code also names the text box and therefore gets away from the ever increasing TextBox10, 11, 12, 13 etc.

So neat as this little snippet is, I lack the ability to add the centered text "Charlie", a chosen background color, and name it TB_Charlie.

I am pretty sure I can get the delete text box code from the macro recorder by going into Design Mode, click on the text box and delete it while recording.

I'm not sure why this Dim statement was included in the code.

Dim oTB As Object

Works okay commented out...?

Thanks.
Howard


Sub TextBoxSelection()
Dim ws As Worksheet

Dim oTB As Object
Set ws = Worksheets("Sheet2")
If TypeName(Selection) = "Range" Then
With Selection
ActiveSheet.Shapes.AddTextBox _
msoTextOrientationHorizontal, .Left, _
.Top, .Width, .Height
End With
End If
End Sub