Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default textbox not updating when controlsource cell changes

I have a userform with textboxes for the user to enter data then click a save
button. This moves the data to a worksheet (hidden) and also into a listbox
on the same userform. (listbox tied to worksheet)

Also on the same userform is a set of textboxes that reflect calcuation
results from the worksheet. Each has a single cell set as the control source.

All that works fine. I type into the textboxes, click the save button, the
data moves into the listbox and the textboxes are updated with the
calculation results.

I wanted to add a way to edit the data already saved to the listbox. When
the user double-clicks an item in the listbox, the data is loaded back into
the textboxes it was orginally entered in. and is removed from the the
listbox(worksheet)

Here is the problem:
Now when I click the save button, the data moves back into the listbox but
the textboxes are not updated with the calculated results.? I ran this with
the worksheet visible and can see the controlsource cells update but the
textbox values will not chage.

Any help would be greatly appreciated!

Here is the code I added as a way to edit the data

Private Sub lbCurrent_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

'when an item is double clicked in the 'current transactions' listbox
'populate the enter a transaction area with the entries for editing

Dim Rowcnt As Long
Dim r As Long

Rowcnt = 0

For r = 0 To lbCurrent.ListCount - 1
If lbCurrent.Selected(r) Then

Rowcnt = r + 11

ufTrustEntry.tbDate.Value = Sheet4.Range("a" & Rowcnt).Value
ufTrustEntry.cbTransaction.Value = Sheet4.Range("d" & Rowcnt).Value
ufTrustEntry.cbAccount.Value = Sheet4.Range("c" & Rowcnt).Value
ufTrustEntry.cbCustomer.Value = Sheet4.Range("b" & Rowcnt).Value
ufTrustEntry.tbAmount.Value = Sheet4.Range("e" & Rowcnt).Value
ufTrustEntry.tbAddInfo.Value = Sheet4.Range("g" & Rowcnt).Value

'Now remove the transaction from the pending list

Dim rng As Range

Set rng = Range(lbCurrent.RowSource)
lbCurrent.RowSource = ""
Sheet4.Range("a" & Rowcnt).EntireRow.Delete
lbCurrent.RowSource = rng.Resize(rng.Rows.Count -
1).Address(external:=True)
Sheet4.Range("n1", "v60").ClearContents
SetupCurrentCalculate
SetupCurrent3083
End If
Next r

Set rng = Nothing

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default textbox not updating when controlsource cell changes

I found the textboxes will update if I reload the userform after the save
button is clicked, but I don't like that flash and delay. The save button
works just fine until I run the code below. The textboxs will update when I
remove entried from the listbox by double clicking an item. As soon as I then
use the save button to put data back into the listbox, the textboxs stop
updating until I reload the userform.

any ideas most welcome
Christy

"Christy" wrote:

I have a userform with textboxes for the user to enter data then click a save
button. This moves the data to a worksheet (hidden) and also into a listbox
on the same userform. (listbox tied to worksheet)

Also on the same userform is a set of textboxes that reflect calcuation
results from the worksheet. Each has a single cell set as the control source.

All that works fine. I type into the textboxes, click the save button, the
data moves into the listbox and the textboxes are updated with the
calculation results.

I wanted to add a way to edit the data already saved to the listbox. When
the user double-clicks an item in the listbox, the data is loaded back into
the textboxes it was orginally entered in. and is removed from the the
listbox(worksheet)

Here is the problem:
Now when I click the save button, the data moves back into the listbox but
the textboxes are not updated with the calculated results.? I ran this with
the worksheet visible and can see the controlsource cells update but the
textbox values will not chage.

Any help would be greatly appreciated!

Here is the code I added as a way to edit the data

Private Sub lbCurrent_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

'when an item is double clicked in the 'current transactions' listbox
'populate the enter a transaction area with the entries for editing

Dim Rowcnt As Long
Dim r As Long

Rowcnt = 0

For r = 0 To lbCurrent.ListCount - 1
If lbCurrent.Selected(r) Then

Rowcnt = r + 11

ufTrustEntry.tbDate.Value = Sheet4.Range("a" & Rowcnt).Value
ufTrustEntry.cbTransaction.Value = Sheet4.Range("d" & Rowcnt).Value
ufTrustEntry.cbAccount.Value = Sheet4.Range("c" & Rowcnt).Value
ufTrustEntry.cbCustomer.Value = Sheet4.Range("b" & Rowcnt).Value
ufTrustEntry.tbAmount.Value = Sheet4.Range("e" & Rowcnt).Value
ufTrustEntry.tbAddInfo.Value = Sheet4.Range("g" & Rowcnt).Value

'Now remove the transaction from the pending list

Dim rng As Range

Set rng = Range(lbCurrent.RowSource)
lbCurrent.RowSource = ""
Sheet4.Range("a" & Rowcnt).EntireRow.Delete
lbCurrent.RowSource = rng.Resize(rng.Rows.Count -
1).Address(external:=True)
Sheet4.Range("n1", "v60").ClearContents
SetupCurrentCalculate
SetupCurrent3083
End If
Next r

Set rng = Nothing

End Sub

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
Trendline Textbox Not Updating Phil Hageman Charts and Charting in Excel 5 September 27th 08 05:11 PM
Textbox updating other Textboxes Thomas L[_2_] Excel Programming 1 July 7th 04 08:33 PM
Textbox ControlSource Property - Excel 97 Tom Ogilvy Excel Programming 0 June 17th 04 09:45 PM
last piece of the puzzle...controlsource in textbox bruce forster Excel Programming 2 April 19th 04 10:45 AM
Problem with TextBox & ControlSource - Please Help [email protected] Excel Programming 8 January 14th 04 06:45 AM


All times are GMT +1. The time now is 05:31 PM.

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

About Us

"It's about Microsoft Excel"