Hi all,
From the below code i cannot get the next row of the column for adding data to another row with having same values in the row. i have tried with command its not showing but there was some mistake inside the command for next getting the next row of column having same value and storing on the row. kindly suggest some code.
Code
Private Sub commandbutton1_click()
Dim prno As String
Dim pono As String
Dim podate As String
Dim rng As range
Dim X As Integer
Dim r As range
Dim rn As range
prno = TextBox1.Text
X = 2
If rng Is Nothing Then
Set rng = Sheet2.Columns("X:X").Find(what:=prno, SearchOrder:=xlByRows)
Set r = rng
Else
Set r = Sheet2.Columns("X:X").Find(what:=prno, after:=rng, SearchOrder:=xlByRows)
End If
If r Is Nothing Then
Else
For Each rn In r
rownumber = rng.Row
pono = TextBox2.Text
Sheet2.Cells(rownumber, 25).value = pono
podate = TextBox3.Text
Sheet2.Cells(rownumber, 26).value = podate
X = X + 1
Next rn
End If
End Sub
Display More