Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    178

    Unanswered: A macro for All worksheets.

    Hi Guys,

    As you can tell by my posts im a newbie, hence the following question.
    I have a macro that works on a specific file, how can i make it so this macro will work on any file.

    This is the first line of the macro

    Windows("rrvtest2.xls").Activate


    Thanks


    aboo

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi aboo

    I am a little unclear what you mean, or what you are trying to do, but this Sub will run code on each (visible) Workbook (file).

    Code:
    Sub UseAllVisibleWorkbooks()
        Dim wdw As Window
        
        For Each wdw In Windows
            If wdw.Visible Then
                With wdw
                    'CODE GOES HERE
                    MsgBox .Parent.Name
                    .ActiveSheet.Cells(4, 9) = "TESTCODE"
                End With
            End If
        Next
    End Sub
    Is that somethink like what you want??

    If not please expand!!

    MTB

  3. #3
    Join Date
    Oct 2003
    Posts
    1,091
    Perhaps if you posted the code, we could help you generalize it.
    old, slow, and confused
    but at least I'm inconsistent!

    Rich
    (retired Excel 2003 user, 3/28/2008)

    How to ask a question on forums

Posting Permissions

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