Text Box ControlSource issues

ultrawat

New Member
Joined
Nov 7, 2005
Messages
47
I have a spreadsheet which has pop-up user form, with text boxes which link to a cell on another sheet in the workbook.

ie the user form pops up, I enter a number in the text box field, and this number appears in the linked cell in a separate worksheet in the workbook.

My problem comes when I save the workbook to a different name. The ControlSource area in the properties fields keeps the cell reference for the 'old' filename.....??

Can anyone help with how this ControlSource link changes to the new file name??

Any help would be really appreciated..... :confused:
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I can reproduce that behaviour only if both workbooks are open and the original workbook is the ActiveWorkbook. Is that the case for you?

I tend to avoid the ControlSource property because it can be problematical. I update the Control in code when the UserForm is shown and the target cell when the value in the Control changes.
 
Upvote 0
Thanks Andrew

I should have said that the process is Save as......

I like the idea of code instead of using ControlSource.

Can you give me a sample code for this process?

Really appreciate your help.....
 
Upvote 0
Sample code:

Code:
Private Sub UserForm_Initialize()
    TextBox1.Value = Worksheets("Sheet1").Range("A1").Value
End Sub

Private Sub TextBox1_Change()
    Worksheets("Sheet1").Range("A1").Value = TextBox1.Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,218,920
Messages
6,145,225
Members
450,603
Latest member
jpbegley

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