populating text box on user forms VBA has stopped working on new worksheets??

dubvalman

New Member
Joined
Dec 7, 2017
Messages
1
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
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,224,827
Messages
6,181,197
Members
453,021
Latest member
pingpong7117

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