Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Excel Vb Form
kvarnerexpress
post Apr 11 2005, 09:26 AM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



I want to populate form values with data if the data chosen in a drop down menu matches with data that is already entered in to the excel sheet. The rest of the values are just textboxes. I was thinking if I could just force the value of the textbox to the data already entered in the sheet, but the form values are not changing. Please help!


Code:
Private Sub wellname_Change()
num = Sheet2.Cells(1, 1) - 1
For Count = 1 To num Step 1
If wellname.Value = Sheet1.Cells(count, 1) Then
UserForm1.point1.Value = Sheet1.Cells(Count, 2)
UserForm1.point2.Value = Sheet1.Cells(Count, 3)
UserForm1.point3.Value = Sheet1.Cells(Count, 4)
UserForm1.point4.Value = Sheet1.Cells(Count, 5)
UserForm1.point5.Value = Sheet1.Cells(Count, 6)
UserForm1.point6.Value = Sheet1.Cells(Count, 7)
UserForm1.point7.Value = Sheet1.Cells(Count, 8)
UserForm1.point8.Value = Sheet1.Cells(Count, 9)
End If
Next Count

End Sub
Go to the top of the page
 
+Quote Post
no9t9
post Apr 11 2005, 12:16 PM
Post #2


Privileged Member
*********

Group: Members
Posts: 773
Joined: 4-November 04
Member No.: 2,118



you need to put .VALUE after everything.

example:
UserForm1.point1.Value = Sheet1.Cells(Count, 2).value

try that. I think that is your problem.
Go to the top of the page
 
+Quote Post
lava.alt
post May 23 2005, 05:08 AM
Post #3


Advanced Member
*******

Group: Members
Posts: 126
Joined: 11-May 05
Member No.: 6,903



thats right ... you have to know to what are you making refence qhen you put "=", in this case to an atribute of a class, in this case a cell
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 6th September 2008 - 02:16 AM