ActiveCell.Value = txtBox.Value ??

  • Thread starter Thread starter lykwid
  • Start date Start date
L

lykwid

private sub btnshowstock_click()

dim row as integer
row = 8

activeworkbook.sheets(\"current stock\").select
activesheet.range(\"a8\").select

do

*if activecell.value <> txtproductcode.value then*

ActiveCell.Offset(1, 0).Select

Row = Row + 1

If Row > 57 Then Exit Sub

End If

:: *Loop Until ActiveCell.Value = txtProductCode.Value*::

ActiveCell.Offset(0, 3).Value = txtCurrentStock.Value

End Sub


This code should run down column A until the value typed in the field
txtProductCode is found. It doesn't.

Instead, it goes until the Row is more than 57 and stops. I think the
rows I have highlighted are the problem as it doesn't seem to stop. Any
ideas anyone? Thanks.
 
Try change the lines to:

if activecell.value<>txtproductcode.text then

and

Loop Until ActiveCell.Value = txtProductCode.text

and see if that works.

private sub btnshowstock_click()

dim row as integer
row = 8

activeworkbook.sheets(\"current stock\").select
activesheet.range(\"a8\").select

do

*if activecell.value <> txtproductcode.value then*

ActiveCell.Offset(1, 0).Select

Row = Row + 1

If Row > 57 Then Exit Sub

End If

:: *Loop Until ActiveCell.Value = txtProductCode.Value*::

ActiveCell.Offset(0, 3).Value = txtCurrentStock.Value

End Sub


This code should run down column A until the value typed in the field
txtProductCode is found. It doesn't.

Instead, it goes until the Row is more than 57 and stops. I think the
rows I have highlighted are the problem as it doesn't seem to stop. Any
ideas anyone? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top