• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

update VBA code when copying sheets

I have a textbox that I want to display the info in B42.

B42 contains a textjoin formula, which means it changes when I input info in another cell. If I link the textbox to b42, it does not automatically update. Not sure why.

So I copied this neat macro and assigned it to a button, so whenever I want to update the textbox, I click on the button and run this macro.

>>> use code - tags <<<
Code:
Sub Do_It()

With ActiveSheet

.Shapes("TextBox 2").TextFrame.Characters.Text = .Range("B42")

End With

End Sub
Now my problem is that when I copy the sheet, the copied sheet textbox is named "textbox 9" and the macro doesn't work.
What are my options?
Thanks!
 
Last edited by a moderator:
If this is a textbox, you should be able to select it, then in the formula bar enter the formula:
=$B$42
then
1 It should update on every change of that cell
2. It doesn't matter what the text box is called, it will copy properly
3. so no vba code necessary
 
Back
Top