Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: auto run macro

  1. #1
    Guest

    Default

    Is there a way to automatically run a macro any time a workbook is opened?
    Thanks,

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Georgia USA
    Posts
    569
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    sure put the code in thisworkbook code replace msgbox with your code

    Sub auto_open()
    MsgBox "your text here"
    'put in module will display a msg box with your text
    'when workbook is opened
    End Sub

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Chippenham, UK
    Posts
    144
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Enter into ThisWorkbook in the VB Editor for the workbook you want the code to run.

    Private Sub Workbook_Open()

    ' your code here or reference to your macro.
    End Sub
    Regards,

    Gary Hewitt-Long

  4. #4
    Guest

    Default

    On 2002-03-03 21:42, gplhl wrote:
    Enter into ThisWorkbook in the VB Editor for the workbook you want the code to run.

    Private Sub Workbook_Open()

    ' your code here or reference to your macro.
    End Sub
    a little sub-question about this problem.
    Is it possible that when the workbook is open the screen will automatic change in a specific color?
    Thanks.

  5. #5
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    For example : change the color to yellow


    Private Sub Workbook_Open()
    Cells.Select
    With Selection.Interior
    .ColorIndex = 6 '(colorindex 6 = yellow)
    .Pattern = xlSolid
    End With
    Range("A1").Select
    End Sub




Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •