View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macro adjustment

Use the worksheetfunction SUM

if WorksheetFunction.Sum(Range("E3:E45")) = 0 then





"Tel" wrote:

Hello,

I have a macro that cuts and pastes as values the contents of cells E3 to
E45 of (Sheet2) to another, hidden, worksheet (sheet6) then unhides and
selects cell C3 of Sheet3.

However, if the values of E3 to E45 ALL equal either "0" or " " then I'd
like to to keep Sheet3 hidden and move on to Sheet 4. But if the value of
even one of the cells from E3 to E45 equals "1", "2", or "3" then I need to
unhide sheet3 and select cell C3 ready for input.

To prove I'm not a complete numpty and I'm learning from you guys, I'm
guessing there's an If and else in there somewhere and that it goes something
like....

If value.Range("E3:E45") = 0 Then
Sheets("Sheet4).Select
Range("C3").Select
Else
Sheets("Sheet3").Visible = True

Sheets("Sheet3").Select
Range("C3").Select
End If

Application.ScreenUpdating = False

End Sub

I tried it but it throws a big red hissy fit at me :-)

Your help is much appreciated.

Regards,

Tel