Forum Discussion
666_666666
May 25, 2023Copper Contributor
Conditional Formating copy VBA
I can't figure out how to copy conditional formatting rules the task is to copy a rule (not a cell format, but a rule) from, for example, a file.xlsx (not necessarily this type, any format that supp...
HansVogelaar
May 26, 2023MVP
If the .xlsm file is the one that contains the macro, and the file created from the template is the active workbook when you run the macro:
Sub CopyFormatting()
ActiveWorkbook.Worksheets(1).Cells.Copy
ThisWorkbook.Worksheets(1).Cells.PasteSpecial Paste:=xlPasteFormats
End Sub666_666666
May 26, 2023Copper Contributor
ThisWorkbook call my add-in (.xlam)
the macro is run from the add-in
as I understand it, when I open the template file, it will become active
we need to get back to the file.xlsm somehow
PS
it's magical! .Name works the way it was supposed
to be solved through it
thank you so much for your help...
I don't understand how it works, but I figured out how to dig into the names of windows only after your answer... non-trivial, I'm used to using the full name (path+name+extension)