link value of cell in last column to inserted text box (via vba)

suremac

New Member
Joined
Jan 27, 2014
Messages
49
Greetings,

I'm trying to create a dynamic chart title by inserting a text box in the chart title that displays the value of the last populated cell in column A. The number of rows increases over time, so I'm trying to come up with a dynamic cell reference. When I hover over the text box a tool tip appears with this text "TextBox 2" so I assume that is the name of the text box. I'm definitely open to other methods that do not use vba. It seems that none of this code can activate the text box:

Code:
Sub textbox()
    Worksheets("Figure3-5").TextBoxes("TextBox 2").Range("A" & Rows.Count).End(xlUp).Value
    End Sub

Code:
Sub textbox()
    Worksheets("Figure3-5").TextBox2.Value = Range("A" & Rows.Count).End(xlUp).Value
    End Sub

Code:
Sub textbox()
    ActiveSheet.Shapes("TextBox 2").Select
    Selection.Characters.Text = Range("A" & Rows.Count).End(xlUp).Value
    End Sub

Thanks in advance for any help.

Regards,
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Through a lot of trial and error I got this code to work:

Code:
Worksheets("Figure3-5").ChartObjects("Chart1").Activate
ActiveChart.Shapes("TextBox 2").TextFrame.Characters.Text = Range("A" & Rows.Count).End(xlUp).Value
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top