Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default userform exception error 4 textboxes

Tony,
You could either restore the formula in the ControlSource
programmatically when your code makes changes to cells the formula
refs, OR use the Worksheet_Change event to update the appropriate
textbox (no ControlSource set). Of course, you'd need a mechanism to
test if the userform is open but that's no problem...

If Not fMyForm Is Nothing Then _
fMyForm.txtMyTextbox.Text = Target.Value

...assumes you also checked to verify that 'Target' is the cell with the
formula linked to your textbox.

From a maintenance standpoint, I'd go with restoring the formula...

sMyLinkedCellFormula = Range("MyLinkedCell").Formula
'..make changes
Range("MyLinkedCell").Formula = sMyLinkedCellFormula

...where your procedure that changes ref'd cells can load the existing
formula into the variable BEFORE making changes, then put it back
afterward.

I recommend using defined names for the cells, scoped local to the
worksheet so there's no ambiguity as to which cells your code works
with when your sheet layout gets revised, or when rows/cols are
inserted/deleted.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform and textboxes Paul Excel Programming 1 June 24th 08 11:21 AM
UserForm TextBoxes Rob Excel Discussion (Misc queries) 2 August 6th 05 03:07 AM
userform & textboxes beginner Excel Programming 3 July 27th 04 10:56 AM
userform textboxes again Jo[_6_] Excel Programming 4 October 21st 03 07:25 PM
userform textboxes Jo[_6_] Excel Programming 4 October 21st 03 07:15 PM


All times are GMT +1. The time now is 06:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"