VB problem for excel

I have an excel spreadsheet and I want to be able to input a number into a cell , which on entering will automatically divide it by 100, without using a visible formula.  This would apply to a range of cells (A1 to A50)

PrickleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MCummings111400Commented:
Copy and Paste the following code into your sheets code module. (In Excel hit ALT-F11, then double click the name of your sheet)

This will divide the cells from A1 to A50 by 100


Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Static bCritical As Boolean

    On Error GoTo err_Handler
    If Not bCritical Then
        bCritical = True
    Else
        Exit Sub
    End If
   
    For Each Cell In Target.Cells
        If Cell.Column = 1 And (Cell.Row >= 1 And Cell.Row <= 50) Then
            Cell.Value = CDec(Cell.Value) / 100
        End If
               
    Next Cell
   
err_Handler:
    bCritical = False
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PrickleAuthor Commented:
Abosolutly bang on. Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.