+ Reply to Thread
Results 1 to 3 of 3

Loop and apply formatting

  1. #1
    Registered User
    Join Date
    10-17-2012
    Location
    nc
    MS-Off Ver
    Excel 2007
    Posts
    14

    Loop and apply formatting

    I'm trying to loop through all worksheets in the active workbook, find a word in the first row, and if that word is found, format the entire column. the code I have below only works if on the active worksheet.

    Please Login or Register  to view this content.
    What's weird is If I uncomment 'ws.Range("A1") = ws.Name and comment out everything else, it actually loops through the worksheets and changes A1 to the sheet name. so something is off on the iloop maybe?

    Thanks

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Loop and apply formatting

    Hi, apunc1,

    maybe just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    10-17-2012
    Location
    nc
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Loop and apply formatting

    Thank you Holger, that works!
    I also need to loop through the same worksheets and move every instance of "Volume" or "Revenue" to the end of the data, delete the first instances so that Volume and Revenue are at the end of the dataset instead of the middle. Do I need to start a new thread for that?

    I have VBS that works for one sheet but when I try to make the script loop through sheets, strange things happen, so I'm trying in Excel VBA then run the macros from the Scripts. Your fix to to the excel vba also works when I call the macros with my scripts.
    Thanks!

    Quote Originally Posted by HaHoBe View Post
    Hi, apunc1,

    maybe just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Ciao,
    Holger

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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