View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Colin Hayes Colin Hayes is offline
external usenet poster
 
Posts: 465
Default Reducing numbers by one in defined areas over several sheets



Hi guys

OK thanks - that's done the trick.

It does give a couple of anomalous results , I find , but I can work
them out.

Thanks again.

BTW Per , could you add a line to the end of the code you gave to select
the first sheet in the wb on completion of the macro?

^_^





In article , Rick Rothstein (MVP
- VB) writes
Give this a try...

Sub DecreaseByOne()
Dim WS As Worksheet
Dim CL As Range
Application.ScreenUpdating = False
For Each WS In Worksheets
For Each CL In WS.Range("A3:N35")
If IsNumeric(CL.Value) Then CL.Value = CL.Value - 1
If CL.Value < 0 Then CL = ""
Next
Next
Application.ScreenUpdating = True
End Sub

Rick


"Colin Hayes" wrote in message
...

Hi

I need some help constructing a macro.

I have a workbook with 12 sheets , A - L.

In each sheet , range A3 - N35 contains a series of numbers , with some
cells being blank.

I need a macro which will go through each sheet , reducing each number it
finds by 1.

Blank cells should be left blank. Where a cell becomes negative after
subtracting 1 from it , this should be made blank too.

Can someone help?

Grateful for any assistance.



Best Wishes