VBA help

J

Jay

Hi,

I'm an excel VBA total novice. I dabble in access vba, but am unsure where
to start in excel.

What I need is some code I can tie to a macro (& keyboard shortcut) which
will find all values under 1000 in the selected range and change them to
1001.

Can anyone point me in the right direction?

Any help greatly appreciated.....thanks, Jason
 
D

Don Guillett

Look in the vba help index for FINDNEXT. There is a good example.
c.value=1001
 
G

Guest

Hi Jay........
I got some similar help from "Ed from Az" and "Hemant_india" in another
group. Perhaps this is what you're looking for.....

Sub ChgValuesInSelectedRange()
Dim Range1 As Range
Dim EaCell As Range
Set Range1 = Selection
For Each EaCell In Range1
If IsNumeric(EaCell.Value) Then
If EaCell.Value < Range("a14").Value And EaCell.Value <> "" Then
EaCell.Value = Range("a15").Value
End If
End If
Next EaCell
End Sub

Vaya con Dios,
Chuck, CABGx3
 
J

Jay

Thanks Chuck...that's great. I've managed to do it thanks to your code.

I've only written VBA for Access (because you *have* to if you want any
proper functionality.

I guess I just have to start thinking in terms of ranges etc., rather
than the access object model.

Thanks again........Regards, Jason, UK
 
C

CLR

You're welcome Jay, glad you got it working. Thanks for the feedback.

Vaya con Dios,
Chuck, CABGx3
 

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

Top