Save Me from My TEXTBOX hell!!!

gman1979

New Member
Joined
Oct 12, 2007
Messages
35
Hi,

pretty new to VBS so heeeellllppppp!!! me, please..

I have created a listbox on a page that displays the contents of another workbook. The contents of which are added via another userform titled “AddNew” I have created a duplicate userform call “Amend”.

What I’d like to be able to is to load the data that corresponds to that entry in the listbox into the “Amend” userform, where the data can be edited and saved over the original value. This would be entered by selecting either by double clicking on the selected row in the listbox or by highlighting a row and selecting another command button.

I’ve trawled the web for help but can’t find anything that closely resembles what I want to do, which is surprising.

so far i have the code below which should populate userform2 with the selected details from the listbox in userform1, however only the 1st value in a row is being populated into textbox1 and i keep getting an error message "could not set the value property"

Private Sub commandbutton1_Click()
Set SourceRange = Range(ListBox1.RowSource)
With UserForm2
.TextBox1.Value = ListBox1.Value
.TextBox2.Value = SourceRange.Offset(ListBox1.ListIndex, 1).Value
.TextBox3.Value = SourceRange.Offset(ListBox1.ListIndex, 2).Value
.TextBox4.Value = SourceRange.Offset(ListBox1.ListIndex, 3).Value
.Show
End With
End Sub

I’m still at a loss as to how to then amend the selected row so that the row in the workbook is updated with he new data.

Any help whatsoever would be greatly appreciated.

Thanks in advance

G
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

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