+ Reply to Thread
Results 1 to 2 of 2

Apply VBA code to multiple sheets

  1. #1
    Registered User
    Join Date
    10-24-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Red face Apply VBA code to multiple sheets

    Hi there,

    I'm pretty new to the whole VBA thing, and I've been trying to figure out how to format all sheets (about a hundred) in my workbook by creating macros.

    What I would like to do is the following:
    - Freeze the top row in every single sheet
    I have used this code:
    Sub freeze()

    With ActiveWindow
    .SplitColumn = 0
    .SplitRow = 1
    End With
    ActiveWindow.FreezePanes = True
    - Create a button on every sheet that you can click on to go back to the first sheet
    I created a button and linked it to this macro
    Sub BackToFirstSheet
    Sheets("Sheet1").Select
    End Sub
    But I am not quite sure if this is the right way to do this.
    - Have the sheets open in A1 and not some random cell in the middle of the sheet
    Any thoughts on how to do this?
    I've found information on how to create macros for a single sheet, but can't seem to find out how to apply this to the whole worksheet.

    Does anyone know how to do this?

    Thanks a mill

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Apply VBA code to multiple sheets

    Perhaps this will get you starterd.
    Please Login or Register  to view this content.
    PS When posting code use code tags for any code, it makes it more readable and easier to copy.
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to apply code to all sheets in an array
    By seethepuck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-16-2013, 03:13 PM
  2. [SOLVED] Can i modify this code to apply to multiple checkboxes and sheets?
    By stolen_83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2013, 02:44 PM
  3. How do I apply a filter across multiple sheets
    By Dan1956 in forum Excel General
    Replies: 0
    Last Post: 08-07-2012, 09:33 AM
  4. Is It Possible To Apply Changes To Multiple Sheets
    By globalpontoon in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-16-2011, 07:45 PM
  5. run code on opening workbook and apply code to certain sheets
    By Jane in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2005, 05:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1