searching a cellvalue in a range

  • Thread starter Thread starter newsbin.telenet.be
  • Start date Start date
N

newsbin.telenet.be

I am familiar with VBA in Access but not in XL.
I am looking for code (On Change event from a Spinbutton) which searches in
a range of cells (called "Schoolyear") the value which stays in cell B10.
If found the value of the cell should change to the value from B10
I started with the code from the Help file but I cannot adapt it.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
end withShould I declare variables and objects?
tks for helping
Michel
 
The code you found in HELP is good. It is looking in range("a1:a500"). So
change that. It is looking for the number 2. If found it is changing the
found cell to 5. Adapt to suit.
 

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