Forum Discussion
dionisio_125
Feb 27, 2024Copper Contributor
create a new pattern style for filling
How to create a new pattern style for filling in a cell format in Excel?
NikolinoDE
Jul 15, 2024Gold Contributor
Creating a custom fill pattern style and adding it to Excel is not a built-in feature within Excel. The application offers a set of predefined patterns and does not provide an interface for creating entirely new fill patterns directly through its standard tools.
daa310
Jul 15, 2024Copper Contributor
NikolinoDE Thank you for the clarification. Is there an indirect method to create new fill patterns? Perhaps a third party application or addin or writing a program?
- NikolinoDEJul 15, 2024Gold Contributor
There are some creative workarounds you can use to achieve a similar effect.
Here is how you can do it:
Workaround: Use Conditional Formatting with Custom Pattern Images
- Create the Custom Pattern Image:
- Use an image editing tool (like Photoshop, GIMP, or even PowerPoint) to create a small image of your desired fill pattern.
- Save the image in a common format (like PNG or JPEG).
- Insert the Image in Excel:
- Open Excel and go to the worksheet where you want to apply the pattern.
- Go to the Insert tab and choose Pictures to insert your custom pattern image.
- Format the Image:
- Resize the image to fit the cell or the range of cells you want to fill. You can adjust the size by dragging the corners of the image.
- Right-click the image and select Format Picture.
- In the Format Picture pane, go to Size & Properties (the icon that looks like a rectangle with arrows) and set the Move and size with cells option under Properties. This ensures the image moves and resizes with the cells if you adjust the row or column sizes.
- Copy the Image to Fill Cells:
- If you need the pattern to fill multiple cells, you can copy and paste the image. Alternatively, you can use Excel's Ctrl + D to drag and duplicate the image across the desired cells.
- Overlay Transparent Cells (Optional):
- If you need to see the cell contents while applying the custom pattern, you can overlay transparent cells. This involves creating a transparent shape (rectangle) and placing it over the image.
- Insert a rectangle shape from the Insert tab (Shapes > Rectangle).
- Format the shape by setting the fill to No Fill and the outline to No Outline.
- Resize the transparent shape to match the size of the image and place it over the image.
Workaround: Use VBA to Apply Custom Pattern
If you are comfortable using VBA, you can create a macro to apply a custom pattern. Here's an example VBA code snippet to create a custom pattern effect using cell shading:
- Open the VBA Editor:
- Press Alt + F11 to open the VBA editor.
- Insert a new module by right-clicking VBAProject (YourWorkbookName) > Insert > Module.
- Add the VBA Code:
- Copy and paste the following code into the module:
Vba Code is untested backup your file first.
Sub ApplyCustomPattern() Dim rng As Range Dim cell As Range Set rng = Selection 'Change to the desired range For Each cell In rng If (cell.Row + cell.Column) Mod 2 = 0 Then cell.Interior.Color = RGB(200, 200, 200) 'Light grey Else cell.Interior.Color = RGB(255, 255, 255) 'White End If Next cell End Sub
3. Run the Macro:
- Close the VBA editor.
- Select the range of cells where you want to apply the custom pattern.
- Press Alt + F8 to open the Macro dialog box, select ApplyCustomPattern, and click Run.
This VBA macro applies a checkerboard pattern to the selected cells by alternating between two colors. You can modify the pattern logic and colors as needed to create different custom patterns.
By using these workarounds, you can achieve a similar effect to custom fill pattern styles in Excel, even though it's not a built-in feature. The text and steps were edited with the help of AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and Like it!
This will help all forum participants.