View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Carim Carim is offline
external usenet poster
 
Posts: 510
Default Macro to turn on/off rowliner?

Ryk,

Following code should help ...

Private Sub Workbook_Open()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "Do you want to use Row Highlighter ?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "Choice"
Help = "DEMO.HLP"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
MyString = "Yes"
Range("A1").Value = 1 ' Adjust to your needs
Else
MyString = "No"
Range("A1").Value = 0
End If
End Sub

This code is to be copied in the module ThisWorkbook (after all your
sheets modules)

In addition, you have to add a test into your sheet module at the very
begining :

If Range("A1").Value = 0 Then
Exit Sub
Else
....
End If ' do not forget to add end if just before End Sub

HTH
Cheers
Carim