View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Savuti Savuti is offline
external usenet poster
 
Posts: 7
Default macro to run IF condition met

Jim thanks for the reply. I did copy and paste your code, I got a Compile
error stating - Else without if.

I have included my complete existing code. Appreciate the help.

Range("B9:I16").Select
ActiveSheet.Unprotect
Range("B15:I15").Select
Selection.Copy
Range("B16:I16").Select
ActiveSheet.Paste
Range("B14:I14").Select
Application.CutCopyMode = False
Selection.Copy
Range("B15:I15").Select
ActiveSheet.Paste
Range("B13:I13").Select
Application.CutCopyMode = False
Selection.Copy
Range("B14:I14").Select
ActiveSheet.Paste
Range("B12:I12").Select
Application.CutCopyMode = False
Selection.Copy
Range("B13:I13").Select
ActiveSheet.Paste
Range("B11:I11").Select
Application.CutCopyMode = False
Selection.Copy
Range("B12:I12").Select
ActiveSheet.Paste
Range("B10:I10").Select
Application.CutCopyMode = False
Selection.Copy
Range("B11:I11").Select
ActiveSheet.Paste
Range("B9:I9").Select
Application.CutCopyMode = False
Selection.Copy
Range("B10:I10").Select
ActiveSheet.Paste
Range("B7:I7").Select
Application.CutCopyMode = False
Selection.Copy
Range("B9:I9").Select
ActiveSheet.Paste
Range("B7:I7").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("B9:I9").Select
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Range("I7").Select
End Sub

"Jim Thomlinson" wrote:

if range("A1").value = 0 then
Range("B9:I16").Select
ActiveSheet.Unprotect
else
msgbox "delete list"
end if
--
HTH...

Jim Thomlinson


"Savuti" wrote:

please help.... I need to have a macro run under the following criteria:

if cell A1 = 0 then run macro
if cell A1 0 then don't run macro and show message box to say "delete list"

below is the begining of the existing code ...... thanks

Range("B9:I16").Select
ActiveSheet.Unprotect