惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
IT之家
IT之家
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
N
Netflix TechBlog - Medium
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
L
LangChain Blog
博客园 - Franky
美团技术团队
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
小众软件
小众软件
Y
Y Combinator Blog
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
D
Docker
Hugging Face - Blog
Hugging Face - Blog
Jina AI
Jina AI
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
Vercel News
Vercel News

rss.livelink.threads-in-node

Probably has less bugs than windows 11 | Microsoft Community Hub Quick question about window PC requirements for meta link cable? Is it possible to run ryujinx canary on an administrator account on windows? Why Windows 11 still depends on 1990s code iphone auf pc spiegeln windows 11 – Welche Methode funktioniert zuverlässig? CHERIoT-Ibex: Closing the door on memory safety vulnerabilities with hardware-enforced protection Known issue: Upgrading Microsoft Tunnel version 20260129.1 What's New in Microsoft Entra: May 2026 Carta de validación TSP (aka.ms/TSP_Achievement_Code_Enroll...) restricted across all accounts unable to enroll Class Admin Build observability for scalable AI apps and agents selling through Microsoft Marketplace Inspektor Gadget Completes Its First Independent Security Audit Retirement of Direct Exchange ActiveSync Certificate-Based Authentication by End of 2026 Export mixed text and tabular Excel to PDF Safely Migrating Terraform Managed Disks on Azure Using Stable Keys and Copilot Microsoft 365 & Power Platform Community call Microsoft 365 & Power Platform product updates call Course Retirement Announcement: AI-3022 The End is Nigh for DES and an Update for hunting down RC4 Unable to Access Scheduling Poll Options Title Plan Update - May 8, 2026 Secure Medallion Architecture Pattern on Azure Databricks (Part II) From Observability to Action: Building an AI-Powered AIOps Agent for Customer-Specific Operations General Availability of Mailbox Import and Export Microsoft Graph APIs Why External Participants Can—or Can’t—Join a Microsoft Teams Meeting CRITICAL: Data Loss on Build 26200.8328 - AI Storage Sense deleted 160+ apps with 870GB free space. Why is everyone hating on Windows 11? I was pissed at the Windows 11 context menu so I built this. Windows 11 Shows ASUS LOGO but then goes dark for 5 minutes Windows 11 causes discrete graphics cards to be locked at their base clock speed when idle
RH | Microsoft Community Hub
RH_ · 2026-05-19 · via rss.livelink.threads-in-node

7 Replies

  • JKPieterse's avatar

    Select any cell which has the right color. Then double-click the format painter. Now you can go about clicking cells and they all get the same formatting. Press the Escape key to stop it.

  • RH_'s avatar

    Good day

    Thank you for the awesome and quick response, however this is not really working as I thought… I would like to select green to fill all cells as necessary and the select the next colour and so forth.

    This script is working on yellow, but I can’t seem to change the colour after that, and when I start with a different colour it only fills x2 cells and then stops.

    Please see screenshot of the current values they are all random.

    Thank you

  • RH_'s avatar

    Good day 

    Thank you for the awesome feedback...it is not working exactly as I thought it would. Please see below the numbers I'm working with. I would like to select a colour then click on the cells to change (Green) after that is finished select the next colour (Blue) until I've highlighted all the blue values then the next colour. (The yellow option in the script seems to be working but I can't change the colour to the next one, and if I start with a different colour, it only fills x2 cells... (All numbers are totally random I might have x3 100 values with different colours.)

  • m_tarler's avatar

    You can use the Format Painter tool to copy the cell format

    but similar to the FILL color button you have to hit it each time so AFAIK a 'locked on' functionality for the Fill (or other excel functions) is not possible with existing excel functionality.  However, this can be achieved using either a macro or a script.  Because (IMHO) things are moving away from macros, here is the code for a script that will use the currently selected cell color and then highlight every other cell you click on that same color until you click on that original cell again ...

    function main(workbook: ExcelScript.Workbook) {
        // Get the active cell and worksheet.
        let selectedCell = workbook.getActiveCell();
        let selectedSheet = workbook.getActiveWorksheet();
    
        const origCell = selectedCell.getAddress();
        const selectedColor = selectedCell.getFormat().getFill().getColor();
        while (selectedCell.getAddress() == origCell) {
            selectedCell = workbook.getActiveCell();
        }
    
        while (selectedCell.getAddress() != origCell) {
        // Set fill color to yellow for the selected cell.
        selectedCell.getFormat().getFill().setColor(selectedColor);
        selectedCell = workbook.getActiveCell();
        }
       
    
    }

    to add this click on the Automate menu item -> New Script -> Create in Code Editor 

    Highlight existing code and replace with the above.  Click on the pencil to rename the script to whatever you want to call it.  and then click save.

    You then have the option to either just click on the run button from this automate menu window or you can add a button to the worksheet.

    OK I updated the script to a) allow you to select and highlight ranges and b) to 'mark' the original cell using a grid pattern to make it easier to find and re-click it to end the script:

    function main(workbook: ExcelScript.Workbook) {
        // Get the active cell and worksheet.
        let selectedCell = workbook.getActiveCell();
        let selectedSheet = workbook.getActiveWorksheet();
        let tmpCell = selectedCell;
        const origCell = selectedCell;
        const origAddress = origCell.getAddress();
        const selectedColor = selectedCell.getFormat().getFill().getColor();
    
    
        while (selectedCell.getAddress() == origAddress) {
            selectedCell = workbook.getSelectedRange();
          origCell.getFormat().getFill().setPattern(ExcelScript.FillPattern.grid);
        }
    
        while (selectedCell.getAddress() != origAddress) {
          selectedCell.getFormat().getFill().setColor(selectedColor);
          selectedCell = workbook.getSelectedRange();
        }
    
        origCell.getFormat().getFill().setPattern(ExcelScript.FillPattern.solid);
    }

    here is a screen shot after I selected the green cell D4 and then selected the range D6:F10

    • NikolinoDE's avatar

      This is BRILLIANT — Office Scripts FTW!

      Thank you for sharing that!

      Your script is a clever solution. This is a great practical workaround. The Automate tab and Office Scripts are indeed the modern replacement for VBA macros, especially in Excel Online and cross-platform environments.

      I'm not sure if this can work quite that way; however, I took the liberty of taking up your suggestion and refining it a bit further 🙂—in doing so, I took into account both the risk of an infinite loop and the scenario where no color was applied to the original cell. Ultimately, everything is now consolidated into a single code block. Please take a look at it and let me know what you think.

      function main(workbook: ExcelScript.Workbook) {
          let selectedRange = workbook.getSelectedRange();
          let origCell = workbook.getActiveCell();
          let origAddress = origCell.getAddress();
          let selectedColor = origCell.getFormat().getFill().getColor();
          
          // Default to yellow if no color
          if (!selectedColor) {
              selectedColor = "#FFFF00";
              origCell.getFormat().getFill().setColor(selectedColor);
          }
          
          // Mark source cell with grid pattern
          origCell.getFormat().getFill().setPattern(ExcelScript.FillPattern.grid);
          
          // Wait for user to move away from source
          while (selectedRange.getAddress() === origAddress) {
              selectedRange = workbook.getSelectedRange();
          }
          
          // Apply color until user returns to source cell
          while (selectedRange.getAddress().indexOf(origAddress) === -1) {
              selectedRange.getFormat().getFill().setColor(selectedColor);
              selectedRange = workbook.getSelectedRange();
          }
          
          // Restore original cell: remove grid pattern, reapply color
          origCell.getFormat().getFill().setPattern(ExcelScript.FillPattern.none);
          origCell.getFormat().getFill().setColor(selectedColor);
      }

      Thanks again for contributing this solution.

      • m_tarler's avatar

        Hi Niko,

          First off, thank you and glad you like my idea.  I like how you cleaned up my code with appropriate comments and other improvements like pulling the 'grid' pattern outside the loop and removing some of those unused variables I had used during testing.  Some of the other changes I'm not as clear about and genuinely interested in how they improve the code.

        For example:

        - the default color section - I considered adding a condition for 'no fill' but detecting that seems to be acting very inconsistently so I didn't bother, but if I did I would then assume they are trying to apply 'no fill' to the other cell and therefore add the folllowing IF statement to both the loop and maybe the final restore original cell
        IF (noFill) {...getFill().clear()} else {...getFill().setColor(selectedColor)}
        but without it, it seems to just treat a 'no fill' cell as a white background (haven't tested darkmode to see if it acts differently there)

        - I presume your comment about an infinite loop is where you changed the While condition to:
        (selectedRange.getAddress().indexOf(origAddress) === -1)
        but I'm curious how or why that will act differently

        - and in general I notice you changed to === instead == which from what I understand is often 'preferred' but my understanding is that === is to make a more stringent exact match and so I specifically chose == to allow less strict matching but in practice in this case I don't think it makes a diffence but would love to understand better.

        - my last question of curiosity is w/r to:
        origCell.getFormat().getFill().setPattern(ExcelScript.FillPattern.none)
        and if or how that is different than setting it to 'solid'

        and again I thought about making this color painter script also include the pattern but again, thought that was maybe an overkill for what they wanted, but wouldn't be that hard to do.