+ Reply to Thread
Results 1 to 6 of 6

assistance to amend vba formating code to apply to all sheets at once

  1. #1
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    assistance to amend vba formating code to apply to all sheets at once

    I have a workbook with lot of sheets which has same formats.

    I used the code below to format the active worksheet at specific columns .

    How to use the code in more elegant way to format all sheets at once without going through sheet to sheet manually.
    Note row 1 are headers .

    Data starts at row 2

    Data range varies per sheets


    Please Login or Register  to view this content.
    Last edited by JEAN1972; 12-16-2018 at 03:51 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: assistance to amend vba formating code to apply to all sheets at once

    Loop through sheets and use the with qualifier getting rid of the selects.

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: assistance to amend vba formating code to apply to all sheets at once

    Give this amended code (untested) a try:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: assistance to amend vba formating code to apply to all sheets at once

    Thank you for assistance, much cleaner and efficient coding

  5. #5
    Forum Contributor
    Join Date
    02-11-2014
    Location
    mauritius
    MS-Off Ver
    MS365
    Posts
    1,086

    Re: assistance to amend vba formating code to apply to all sheets at once

    Tried Alan but Getting runtime error 1004

    Select range class method failed

    Please Login or Register  to view this content.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: assistance to amend vba formating code to apply to all sheets at once

    Need to add ws. in front of each selection line.

+ 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] assistance to modify vba code existing code sheets name to sheet tab names in filtering
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2018, 03:58 AM
  2. [SOLVED] amend code to clear contents and format in vba except row 1 in specific sheets
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2018, 10:36 AM
  3. [SOLVED] assistance to amend code for a closed workbook to remain close when macro runs
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-03-2017, 12:43 PM
  4. [SOLVED] Want to apply code to all sheets available in workbook except two sheets with fast working
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-28-2017, 08:55 AM
  5. Apply VBA code to multiple sheets
    By PaulusKabouter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2013, 11:37 AM
  6. Amend code to Sort Sheets by number
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-02-2008, 09:03 AM
  7. 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