Hi All
I have code which I have used in many projects that always worked and returned the desired results. I am presently producing another spread sheet and the VBA for retrieving data from a sheet to the userform based on a specific criteria is not working.
I tried the back up code but this is also not working. The strange thing is that the same code works in all the previous userforms/sheets I have made.
I am new to VBA and have tried numerous searches to get an answer but nothing is helping.
Can someone shed light on this. I have the macros enabled etc. in the two versions of excel I have. Excel 2010 and 2016
I am not sure how to attach a sample file but the code below is the code that always worked before.
Private Sub CommandButton1_Click()
row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheets("Sheet1").Range("B" & row_number)
If item_in_review = tb_AuditRef Then
'get data
Me.TextBox2 = Sheets("Sheet1").Range("C" & row_number)
Me.TextBox3 = Sheets("Sheet1").Range("D" & row_number)
Me.TextBox4 = Sheets("Sheet1").Range("E" & row_number)
Me.TextBox5 = Sheets("Sheet1").Range("F" & row_number)
End If
Loop Until item_in_review = ""
End Sub
thanks in advance
Steve
I have code which I have used in many projects that always worked and returned the desired results. I am presently producing another spread sheet and the VBA for retrieving data from a sheet to the userform based on a specific criteria is not working.
I tried the back up code but this is also not working. The strange thing is that the same code works in all the previous userforms/sheets I have made.
I am new to VBA and have tried numerous searches to get an answer but nothing is helping.
Can someone shed light on this. I have the macros enabled etc. in the two versions of excel I have. Excel 2010 and 2016
I am not sure how to attach a sample file but the code below is the code that always worked before.
Private Sub CommandButton1_Click()
row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheets("Sheet1").Range("B" & row_number)
If item_in_review = tb_AuditRef Then
'get data
Me.TextBox2 = Sheets("Sheet1").Range("C" & row_number)
Me.TextBox3 = Sheets("Sheet1").Range("D" & row_number)
Me.TextBox4 = Sheets("Sheet1").Range("E" & row_number)
Me.TextBox5 = Sheets("Sheet1").Range("F" & row_number)
End If
Loop Until item_in_review = ""
End Sub
thanks in advance
Steve