Forum Discussion
Fchedraoui
Apr 05, 2022Copper Contributor
VBA Range Format
VBA, F2:F99999 = date format = 18-sept-21 "Range("F2:F99999").Numberformat = "yyyy-mm-dd"" works and format come as 2021-09-18 as custom but then changes format after closing excel. when i reop...
- Apr 05, 2022
WAW nice! Bingo!
Explain.. :
.formula means what ?
the IF is an IF excel function? if so, then F2="""" is the logical test ? does it mean if empty? why 4 of "
then , """" means value if true? and then ,TEXT(F2,""yyy-mm-dd"") if value if false?
.Numberformat = "@" will format G column as TEXT
.value (G2) = .value (F2) <-- how does it know this is F2 ?
end with (end loop)
sorry for all the questions but i want to understand it.
Thank you so much
mtarler
Apr 05, 2022Silver Contributor
I tested it in a sheet and it seemed to work fine. I tested inside a table, inside a spill range, regular values and it saved the custom format in every case.
Since it is a macro enabled file (I assume) is it possible there is some other macro that runs on opening/closing/etc... that is overriding the custom formatting?
Since it is a macro enabled file (I assume) is it possible there is some other macro that runs on opening/closing/etc... that is overriding the custom formatting?