ronlaude
06-07-2012, 02:38 AM
hello everyone, i have a problem... i want to view and edit a value of a cell through a textbox in a user form.
i have used this code and it worked perfectly:
Private Sub CommandButton1_Click()
'Australia
If ComboBox1 = "Australia" Then
Set rngText1 = Range("A1")
End If
'China
If ComboBox1 = "China" Then
Set rngText1 = Worksheets("Sheet1").Range("A2")
End If
'India
If ComboBox1 = "India" Then
Set rngText1 = Worksheets("Sheet1").Range("A3")
End If
rngText1.Value = TextBox1.Text
End Sub
but my problem is when i tried to incorporate it in a large amount of information and i used a code like this:
With Workbooks(ThisWorkbook.Name).Worksheets("Sheet1")
For Each d In .Range("a3:a60000")
If d.Value = clientname1.Value Then
rmno1.Value = d.Offset(0, 26).Value
If rmno1.Value = d.Offset(0, 26).Value Then
ElseIf d.Value = "" Then
Exit For
End If
Next d
End With
nothing happens... can someone help me with this one? thanks!
i have used this code and it worked perfectly:
Private Sub CommandButton1_Click()
'Australia
If ComboBox1 = "Australia" Then
Set rngText1 = Range("A1")
End If
'China
If ComboBox1 = "China" Then
Set rngText1 = Worksheets("Sheet1").Range("A2")
End If
'India
If ComboBox1 = "India" Then
Set rngText1 = Worksheets("Sheet1").Range("A3")
End If
rngText1.Value = TextBox1.Text
End Sub
but my problem is when i tried to incorporate it in a large amount of information and i used a code like this:
With Workbooks(ThisWorkbook.Name).Worksheets("Sheet1")
For Each d In .Range("a3:a60000")
If d.Value = clientname1.Value Then
rmno1.Value = d.Offset(0, 26).Value
If rmno1.Value = d.Offset(0, 26).Value Then
ElseIf d.Value = "" Then
Exit For
End If
Next d
End With
nothing happens... can someone help me with this one? thanks!