If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > A macro for All worksheets.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-05-06, 02:16
aboo aboo is offline
Registered User
 
Join Date: May 2006
Posts: 178
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
Reply With Quote
  #2 (permalink)  
Old 06-05-06, 08:21
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
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
Reply With Quote
  #3 (permalink)  
Old 06-05-06, 15:58
shades shades is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On