Change date format.

%3CLINGO-SUB%20id%3D%22lingo-sub-1238372%22%20slang%3D%22en-US%22%3EChange%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1238372%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20struggle%20getting%20the%20date%20format%20change.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20there%20stay%202020.03.20%20in%20A1%20anf%20i%20mark%20A1%2C%20and%20change%20the%20format%20from%20yyyy.mm.dd%20to%20dd.mm.yyy%20A1%20do%20not%20change.%20Still%20it%20stay%202020.03.20%20in%20stead%20for%2020.03.2020.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20use%20this%20command%20in%20a%20macro%20where%20i%20mark%20all%20dates%20in%20a%20row%20and%20change%20the%20date%20format%20as%20i%20explained%20abowe.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20someone%20help%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1238372%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1238518%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1238518%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587018%22%20target%3D%22_blank%22%3E%40larsgunnar007%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20changing%20the%20date%20format%20in%20A1%20doesn't%20change%20the%20display%20format%20of%20the%20date%20in%20A1%20that%20means%20the%20date%20in%20A1%20looks%20like%20a%20date%20but%20in%20fact%20it%20is%20a%20date%20string.%3C%2FP%3E%3CP%3ERemember%20that%20Excel%20treats%20dates%20as%20real%20numbers%20and%20to%20check%20whether%20the%20date%20in%20A1%20is%20a%20real%20date%20or%20not%2C%20put%20the%20formula%20%3CSTRONG%3E%3DISNUMBER(A1)%3C%2FSTRONG%3E%20in%20a%20blank%20cell.%20If%20the%20formula%20returns%20a%20True%20that%20means%20the%20A1%20contains%20a%20real%20date%20but%20if%20the%20formula%20returns%20False%2C%20A1%20contains%20a%20text%20string%20which%20looks%20like%20a%20date%20but%20not%20a%20real%20date.%3C%2FP%3E%3CP%3EWhat%20date%20separator%20do%20you%20use%20as%20per%20your%20regional%20settings%3F%20Is%20it%20a%20dot%20(period)%3F%3C%2FP%3E%3CP%3EIf%20yes%2C%20select%20the%20date%20in%20A1%2C%20go%20to%20%3CSTRONG%3EData%20Tab%3C%2FSTRONG%3E%20--%26gt%3B%20%3CSTRONG%3EText%20to%20Columns%3C%2FSTRONG%3E%20--%26gt%3B%20click%20on%20%3CSTRONG%3EFinish%3C%2FSTRONG%3E%20in%20the%20next%20step.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20would%20convert%20the%20date%20text%20string%20into%20a%20real%20date%20and%20then%20you%20can%20change%20the%20formatting%20of%20the%20date%20without%20an%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1238705%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1238705%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587018%22%20target%3D%22_blank%22%3E%40larsgunnar007%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20again%20and%20thanks%20for%20your%20answer%3C%2FP%3E%3CP%3Efrom%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESubodh_Tiwari_sktneer%20(Valued%20Contributor)%20mentioned%20you%20in%20a%20post!%20Join%20the%20conversation%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFirst%20of%20all%20the%20common%20%3DISNUMBER(A1)%2C%20in%20Norwegian%20ERNUM%20(A1)%2C%20returns%20%23NAVN%3F%20probably%20(%23NAME%3F)%2C%20Not%20true%20or%20False.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20tried%20the%20Function%20%22Text%20to%20Colums%22%20it%20work%20only%20when%20i%20tried%20a%20singel%20cell.%20With%20multiply%20cells..%20-Excel%20returns%20%22the%20function%20do%20not%20work%20in%20multiply%20cells%22.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I'm%20still%20stuck%20to%20return%20that%20date%20format%20from%20yyyy.mm.dd%20to%20dd.mm.yyyy%20still.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20any%20more%20solutions%20to%20change%20multiply%20date%20cells%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20best%20from%3C%2FP%3E%3CP%3ELars%20Gunnar%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1238775%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1238775%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587018%22%20target%3D%22_blank%22%3E%40larsgunnar007%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20please%20upload%20a%20sample%20workbook%20to%20see%20how%20your%20data%20is%20organized%20on%20the%20sheet%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20actually%20didn't%20reply%20the%20following%20question.%3C%2FP%3E%3CP%3E%3CEM%3EWhat%20date%20separator%20do%20you%20use%20as%20per%20your%20regional%20settings%3F%20Is%20it%20a%20dot%20(period)%3F%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1241881%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1241881%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOf%20course.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20mark%20the%20Row%20green%20where%20I%20want%20do%20change%20the%20datoformat%20all-in-one%20operation.%20An%20put%20it%20in%20the%20attached%20macro.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYes%20I%20separate%20with%20dot%20(.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExchangeConverter.xlsm%20Attached.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20exited%20to%20hear%20your%20solution.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESincerely%3C%2FP%3E%3CP%3ELars%20Gunnar%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1242200%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1242200%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587018%22%20target%3D%22_blank%22%3E%40larsgunnar007%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20give%20the%20following%20code%20a%20try%20which%20may%20or%20may%20not%20work%20as%20dates%20are%20tricky%20to%20handle.%3C%2FP%3E%3CP%3EMy%20default%20date%20format%20is%20mm%2Fdd%2Fyyyy%20and%20changed%20it%20to%20mm.dd.yyyy%20to%20test%20the%20code%20for%20you%20and%20it%20worked%20on%20my%20end%20but%20not%20sure%20how%20this%20would%20work%20on%20your%20end.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInsert%20a%20New%20Module%20say%20Module2%20and%20place%20the%20codes%20given%20below%20on%20to%20Module2%20and%20run%20the%20code%20ConvertToDates.%20The%20code%20will%20prompt%20you%20to%20select%20the%20Date%20cells%20and%20you%20should%20select%20the%20green%20cells%20with%20dates%20and%20press%20OK%20to%20continue.%3C%2FP%3E%3CP%3EAfter%20code%20is%20run%2C%20let%20me%20know%20if%20the%20code%20converts%20all%20the%20dates%20into%20the%20real%20dates.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EDim%20dtFound%20As%20Boolean%0A%0ASub%20ConvertToDates()%0ADim%20Rng%20As%20Range%0ADim%20Cel%20As%20Range%0A%0AOn%20Error%20Resume%20Next%0ASet%20Rng%20%3D%20Application.InputBox(%22Please%20select%20the%20Cells%20with%20Date%20in%20them.%22%2C%20%22Convert%20Date%20String%20Into%20Real%20Date!%22%2C%20Type%3A%3D8)%0AOn%20Error%20GoTo%200%0A%0AApplication.ScreenUpdating%20%3D%20False%0A%0AIf%20Rng%20Is%20Nothing%20Then%0A%20%20%20%20MsgBox%20%22You%20didn't%20select%20the%20Date%20Cells!%22%2C%20vbExclamation%0A%20%20%20%20Exit%20Sub%0AEnd%20If%0A%0AFor%20Each%20Cel%20In%20Rng%0A%20%20%20%20Cel.Value%20%3D%20DateStringToDate(Cel.Text)%0A%20%20%20%20If%20dtFound%20Then%0A%20%20%20%20%20%20%20%20Cel.TextToColumns%20Destination%3A%3DCel%0A%20%20%20%20%20%20%20%20dtFound%20%3D%20False%0A%20%20%20%20End%20If%0ANext%20Cel%0ARng.NumberFormat%20%3D%20%22dd.mm.yyyy%22%0AApplication.ScreenUpdating%20%3D%20True%0AEnd%20Sub%0A%0AFunction%20DateStringToDate(ByVal%20str%20As%20String)%0ADim%20Matches%20As%20Object%0ADim%20y%20%20%20%20%20%20%20As%20Long%0ADim%20m%20%20%20%20%20%20%20As%20Long%0ADim%20d%20%20%20%20%20%20%20As%20Long%0AWith%20CreateObject(%22VBScript.RegExp%22)%0A%20%20%20%20.Global%20%3D%20False%0A%20%20%20%20.Pattern%20%3D%20%22(%5Cd%7B4%7D)%5C.(%5Cd%7B2%7D)%5C.(%5Cd%7B2%7D)%22%0A%20%20%20%20If%20.Test(str)%20Then%0A%20%20%20%20%20%20%20%20dtFound%20%3D%20True%0A%20%20%20%20%20%20%20%20Set%20Matches%20%3D%20.Execute(str)%0A%20%20%20%20%20%20%20%20y%20%3D%20Matches(0).SubMatches(0)%0A%20%20%20%20%20%20%20%20m%20%3D%20Matches(0).SubMatches(1)%0A%20%20%20%20%20%20%20%20d%20%3D%20Matches(0).SubMatches(2)%0A%20%20%20%20%20%20%20%20DateStringToDate%20%3D%20DateSerial(y%2C%20m%2C%20d)%0A%20%20%20%20Else%0A%20%20%20%20%20%20%20%20DateStringToDate%20%3D%20str%0A%20%20%20%20End%20If%0AEnd%20With%0AEnd%20Function%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EIn%20the%20attached%2C%20I%20have%20placed%20the%20code%20on%20Module2%20for%20you%20to%20test.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1244472%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1244472%22%20slang%3D%22en-US%22%3EHello%2C%20let%20assume%20you%20want%20to%20change%20the%20date%20format%20from%20mm%2Fdd%2Fyyyy%20to%20dd%2Fmm%2Fyyyy%20or%20dd.mm.yyyy.%3CBR%20%2F%3E%3CBR%20%2F%3EYo%20can%20make%20the%20permanent%20change%20in%20the%20Control%20Panel%20of%20your%20system.%20To%20do%20that%2C%20kindly%20follow%20the%20steps%20below%3CBR%20%2F%3E1.%20Type%20in%20Control%20Panel2.%20Under%20Clock%20and%20Region%2C%20click%20on%20change%20date%2C%20time%20or%20number%20formats%20%3CBR%20%2F%3E3.%20Click%20on%20Additional%20settings%20%3CBR%20%2F%3E4.%20Click%20on%20Date%20tab%3CBR%20%2F%3E5.%20In%20the%20Short%20date%20under%20Date%20Format%2C%20specify%20the%20date%20format%20you%20want%20i.e.%20dd%2Fmm%2Fyyyy%3CBR%20%2F%3E6.%20Click%20OK.%3CBR%20%2F%3E%3CBR%20%2F%3EThe%20above%20steps%20will%20permanently%20take%20effect%20on%20your%20system%20including%20on%20Excel%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1246143%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1246143%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20again.%3C%2FP%3E%3CP%3EI%20think%20this%20is%20a%20kind%20of%20bug%20or%20fault%20in%20Excel.%3C%2FP%3E%3CP%3EI%20followed%20your%20advice%26nbsp%3Blooked%20into%20the%20CP%20the%20short%20format%20who%20was%20like%20this%20dd.MM.YYYY%20and%20long%20like%20dddd%20d.%20MMMM%20YYYY.%3C%2FP%3E%3CP%3EI%20tried%20to%20change%20to%20small%20letters%20like%20dd.mm.yyyy%20and%20dddd%20d.mmmm%20yyyy%20but%20W10%20returned%20%22one%20or%20several%20of%20the%20letters%20you%20tried%20are%20invalid...%22%20..so%20i%20had%20to%20use%20the%20letters%20as%20shown%20above.%20That%20is%20also%20the%20format%20I%20want.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20tried%20other%20formats%20but%20still%20the%20format%20return%20original%20from%20the%20imported%20source.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20can%20say%20is%20that%20here%20must%20MS%20make%20a%20change%20in%20Excel%20or%20make%20a%20command%20who%20clean%20Cells%20from%20invisible%20characters%20without%20without%20deleting%20the%20cell%20content.%20I'm%20convinced%20that%20it%20is%20these%20characters%20who%20make%20the%20challenge%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20google%20this%2C%20i%20can%20see%20that%20someone%20import%20the%20data%20into%20Notebook%20and%20restore%20it%20in%20Excel.%20That's%20not%20a%20good%20solution%20I%20thing.%20So%20I%20beg%20you%20to%20come%20up%20with%20something%20who%20%22walk%20around%22%20this%20fault%20in%20Excel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20so%20far.%3C%2FP%3E%3CP%3ESincerely%3C%2FP%3E%3CP%3ELars%20Gunnar%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1246484%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1246484%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F587018%22%20target%3D%22_blank%22%3E%40larsgunnar007%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDid%20you%20try%20the%20code%20in%20the%20file%20I%20uploaded%20in%20my%20last%20post%3F%3C%2FP%3E%3CP%3EIf%20not%2C%20download%20and%20save%20that%20file.%3C%2FP%3E%3CP%3ENow%20open%20the%20file%2C%20%3CSTRONG%3Eenable%20the%20editing%3C%2FSTRONG%3E%20when%20prompted%20and%20then%20press%20%3CSTRONG%3EAlt%2BF8%3C%2FSTRONG%3E%20to%20open%20Macros%20window%2C%20select%20the%20macro%20%3CSTRONG%3EConvertToDates%3C%2FSTRONG%3E%20and%20hit%20Run%20and%20let%20me%20know%20if%20the%20code%20works%20as%20desired.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%2C%20open%20a%20new%20blank%20workbook%20and%20input%20a%20valid%20date%20in%20the%20cell%20A1%20and%20a%20formula%20%3DISNUMBER(A1)%20in%20the%20cell%20B1%20and%20share%20the%20screenshot%20of%20both%20the%20cells%20to%20see%20what's%20your%20valid%20date%20format%20and%20what%20does%20the%20formula%20in%20B1%20returns.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1256415%22%20slang%3D%22en-US%22%3ERe%3A%20Change%20date%20format.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1256415%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F394231%22%20target%3D%22_blank%22%3E%40Subodh_Tiwari_sktneer%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20again%20Subodh.%20I%20have%20been%20occupied%20but%20now%20I%20have%20tested%20and%20can%20comment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMICROSOFT%20CHALLENGE%3C%2FP%3E%3CP%3EI%20really%20stay%20on%20my%20opinion%20that%20changing%20the%20date%20format%20should%20reply%20the%20date%20in%20the%20columns%20marked.%20Not%20doing%20a%20lot%20of%20strange%20commands%20to%20make%20i%20append.%20If%20you%20mark%20and%20change%20the%20number-format%20in%20a%20cell%20or%20-severals%2C%20it%20change%20the%20cell%20contents%20promptly!%20This%20should%20happens%20in%20changing%20date%20formats%20too.%20I%20want%20you%20to%20report%20this%20challenge%20in%20to%20the%20developers%20of%20Excel%20an%20give%20me%20a%20feedback%20when%20that%20happens.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EISNUMBER%3C%2FP%3E%3CP%3EWell%2C%20i%20tried%20your%20%22ISNUMBER%22%20command.%20If%20i%20I%20put%20the%20date%2025.10.1960%20into%20A1%20i%20get%20True%20in%20B1.%20If%20i%20tried%20to%20write%201960.10.25%20the%20cell%20reply%2025.10.1960.%20If%20i%201st%20time%20put%201960.10.25%20the%20cell%2C%20it%20returns%201960.10.25%20and%20B1%20says%20true.%20If%20I%20try%2025.10.60%20the%20cell%20return%201960.10.25.%20And%20B1%20return%20true.%20So%20I%20think%20the%201st%20written%20date%20in%20a%20cell%20stays%20with%20that%20format.%20And%20if%20i%20hange%20the%20format%20i%20tht%20cell%20it%20didn't%20return%20to%20the%26nbsp%3B%20the%20new%20chosen%20format.%20And%20that's%20the%20problem%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMACROS%3C%2FP%3E%3CP%3ESo-%20..I%20looked%20into%20your%20Macro.%20It%20was%20really%20cool%20I%20think.%20I%20do%20not%20program%20Macros%20on%20that%20level.%20My%20way%20are%20to%20try%20using%20the%20record%20function%20and%20try%20to%20learn%20that%20way.%20When%20I%20tried%20your%20Macro%20it%20worked%20well.%20The%20challenge%20was%20that%20the%20macro%20use%20a%20lot%20of%20time%20to%20go%20among%20all%20the%20date%20cells%20marked.%20It%20seems%20to%20add%20%5BCR%5D%20cell%20by%20sell%20from%20G24%20to%20GMA24%20who%20is%20all%20currency%20dates%20in%20the%20worksheet%20shown%20to%20you.%20Actually%20I%20also%20tried%20to%20mark%20from%20G24%20ro%20the%20right%20end%20of%20the%20sheet.%20The%20reason%20why%2C%20is%20that%20i%20want%20to%20have%20that%20mark%20fixed%20in%20stead%20of%20mark%20manually.%20When%20I%20go%20to%20the%20end%20I%20secure%20all%20the%20incremented%20dates%20who%20new%20imported%20sheets%20will%20have%20from%20the%20Norwegian%20Bank.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENOTEPAD%20VARIANT%3C%2FP%3E%3CP%3EI%20also%20tried%20to%20mark%20all%20date%20columns%2C%20changing%20the%20date%20format%20to%20dd.mm.yyyy%2C%20copy%20them%20to%20NotePad%20and%20paste%20back%20again%20to%20excel.%20Problem%20solved!%20If%20I%20want%20to%20program%20this%20in%20a%20macro%20it%20stopped%20for%20me%20after%20starting%20NotePad.%20I%20didnt%20find%20any%20command%20to%20view%20Notpad%20and%20put%20the%20cursor%20into%20the%20opened%20NotePad%20Sheet.%20I%20could%20not%20find%20any%20command%20to%20close%20Notepad%20either.%20So%20maybe%20you%20can%20help%20here%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFINALLY%3C%2FP%3E%3CP%3EIt's%26nbsp%3BDefinitively%20not%20getting%20rid%20of%20rubbish-formatting%20in%20the%20cell%20who%20case%20this%20problem%20i%20think.%20Therefore%20must%20there%20be%20a%20command%20who%20delete%20all%20formatting%20before%20setting%20the%20wanted%20format.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWaiting%204%20Your%20reply.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESincerely%3C%2FP%3E%3CP%3ELars%20Gunnar%20Nesseth%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hi.

 

I struggle getting the date format change.

 

If there stay 2020.03.20 in A1 anf i mark A1, and change the format from yyyy.mm.dd to dd.mm.yyy A1 do not change. Still it stay 2020.03.20 in stead for 20.03.2020.

 

I use this command in a macro where i mark all dates in a row and change the date format as i explained abowe.

 

Can someone help?

9 Replies
Highlighted

@larsgunnar007 

If changing the date format in A1 doesn't change the display format of the date in A1 that means the date in A1 looks like a date but in fact it is a date string.

Remember that Excel treats dates as real numbers and to check whether the date in A1 is a real date or not, put the formula =ISNUMBER(A1) in a blank cell. If the formula returns a True that means the A1 contains a real date but if the formula returns False, A1 contains a text string which looks like a date but not a real date.

What date separator do you use as per your regional settings? Is it a dot (period)?

If yes, select the date in A1, go to Data Tab --> Text to Columns --> click on Finish in the next step.

 

This would convert the date text string into a real date and then you can change the formatting of the date without an issue.

Highlighted

@larsgunnar007 

Hi again and thanks for your answer

from;

Subodh_Tiwari_sktneer (Valued Contributor) mentioned you in a post! Join the conversation below:

 

First of all the common =ISNUMBER(A1), in Norwegian ERNUM (A1), returns #NAVN? probably (#NAME?), Not true or False.

 

When I tried the Function "Text to Colums" it work only when i tried a singel cell. With multiply cells.. -Excel returns "the function do not work in multiply cells". 

 

So I'm still stuck to return that date format from yyyy.mm.dd to dd.mm.yyyy still.

 

Is there any more solutions to change multiply date cells?

 

The best from

Lars Gunnar

 

@larsgunnar007 

Can you please upload a sample workbook to see how your data is organized on the sheet?

 

You actually didn't reply the following question.

What date separator do you use as per your regional settings? Is it a dot (period)?

Highlighted

@Subodh_Tiwari_sktneer 

Of course.

 

I mark the Row green where I want do change the datoformat all-in-one operation. An put it in the attached macro.

 

Yes I separate with dot (.)

 

ExchangeConverter.xlsm Attached.

 

I'm exited to hear your solution.

 

Sincerely

Lars Gunnar

 

Highlighted

@larsgunnar007 

 

Please give the following code a try which may or may not work as dates are tricky to handle.

My default date format is mm/dd/yyyy and changed it to mm.dd.yyyy to test the code for you and it worked on my end but not sure how this would work on your end.

 

Insert a New Module say Module2 and place the codes given below on to Module2 and run the code ConvertToDates. The code will prompt you to select the Date cells and you should select the green cells with dates and press OK to continue.

After code is run, let me know if the code converts all the dates into the real dates.

 

Dim dtFound As Boolean

Sub ConvertToDates()
Dim Rng As Range
Dim Cel As Range

On Error Resume Next
Set Rng = Application.InputBox("Please select the Cells with Date in them.", "Convert Date String Into Real Date!", Type:=8)
On Error GoTo 0

Application.ScreenUpdating = False

If Rng Is Nothing Then
    MsgBox "You didn't select the Date Cells!", vbExclamation
    Exit Sub
End If

For Each Cel In Rng
    Cel.Value = DateStringToDate(Cel.Text)
    If dtFound Then
        Cel.TextToColumns Destination:=Cel
        dtFound = False
    End If
Next Cel
Rng.NumberFormat = "dd.mm.yyyy"
Application.ScreenUpdating = True
End Sub

Function DateStringToDate(ByVal str As String)
Dim Matches As Object
Dim y       As Long
Dim m       As Long
Dim d       As Long
With CreateObject("VBScript.RegExp")
    .Global = False
    .Pattern = "(\d{4})\.(\d{2})\.(\d{2})"
    If .Test(str) Then
        dtFound = True
        Set Matches = .Execute(str)
        y = Matches(0).SubMatches(0)
        m = Matches(0).SubMatches(1)
        d = Matches(0).SubMatches(2)
        DateStringToDate = DateSerial(y, m, d)
    Else
        DateStringToDate = str
    End If
End With
End Function

In the attached, I have placed the code on Module2 for you to test.

 

 

Highlighted
Hello, let assume you want to change the date format from mm/dd/yyyy to dd/mm/yyyy or dd.mm.yyyy.

Yo can make the permanent change in the Control Panel of your system. To do that, kindly follow the steps below
1. Type in Control Panel
2. Under Clock and Region, click on change date, time or number formats
3. Click on Additional settings
4. Click on Date tab
5. In the Short date under Date Format, specify the date format you want i.e. dd/mm/yyyy
6. Click OK.

The above steps will permanently take effect on your system including on Excel
Highlighted

@Subodh_Tiwari_sktneer 

Hi again.

I think this is a kind of bug or fault in Excel.

I followed your advice looked into the CP the short format who was like this dd.MM.YYYY and long like dddd d. MMMM YYYY.

I tried to change to small letters like dd.mm.yyyy and dddd d.mmmm yyyy but W10 returned "one or several of the letters you tried are invalid..." ..so i had to use the letters as shown above. That is also the format I want.

 

I also tried other formats but still the format return original from the imported source.

 

What I can say is that here must MS make a change in Excel or make a command who clean Cells from invisible characters without without deleting the cell content. I'm convinced that it is these characters who make the challenge here.

 

When I google this, i can see that someone import the data into Notebook and restore it in Excel. That's not a good solution I thing. So I beg you to come up with something who "walk around" this fault in Excel.

 

Thank you so far.

Sincerely

Lars Gunnar

Highlighted

@larsgunnar007 

Did you try the code in the file I uploaded in my last post?

If not, download and save that file.

Now open the file, enable the editing when prompted and then press Alt+F8 to open Macros window, select the macro ConvertToDates and hit Run and let me know if the code works as desired.

 

Also, open a new blank workbook and input a valid date in the cell A1 and a formula =ISNUMBER(A1) in the cell B1 and share the screenshot of both the cells to see what's your valid date format and what does the formula in B1 returns.

Highlighted

@Subodh_Tiwari_sktneer 

 

Hi again Subodh. I have been occupied but now I have tested and can comment.

 

MICROSOFT CHALLENGE

I really stay on my opinion that changing the date format should reply the date in the columns marked. Not doing a lot of strange commands to make i append. If you mark and change the number-format in a cell or -severals, it change the cell contents promptly! This should happens in changing date formats too. I want you to report this challenge in to the developers of Excel an give me a feedback when that happens.

 

ISNUMBER

Well, i tried your "ISNUMBER" command. If i I put the date 25.10.1960 into A1 i get True in B1. If i tried to write 1960.10.25 the cell reply 25.10.1960. If i 1st time put 1960.10.25 the cell, it returns 1960.10.25 and B1 says true. If I try 25.10.60 the cell return 1960.10.25. And B1 return true. So I think the 1st written date in a cell stays with that format. And if i hange the format i tht cell it didn't return to the  the new chosen format. And that's the problem here.

 

MACROS

So- ..I looked into your Macro. It was really cool I think. I do not program Macros on that level. My way are to try using the record function and try to learn that way. When I tried your Macro it worked well. The challenge was that the macro use a lot of time to go among all the date cells marked. It seems to add [CR] cell by sell from G24 to GMA24 who is all currency dates in the worksheet shown to you. Actually I also tried to mark from G24 ro the right end of the sheet. The reason why, is that i want to have that mark fixed in stead of mark manually. When I go to the end I secure all the incremented dates who new imported sheets will have from the Norwegian Bank.

 

NOTEPAD VARIANT

I also tried to mark all date columns, changing the date format to dd.mm.yyyy, copy them to NotePad and paste back again to excel. Problem solved! If I want to program this in a macro it stopped for me after starting NotePad. I didnt find any command to view Notpad and put the cursor into the opened NotePad Sheet. I could not find any command to close Notepad either. So maybe you can help here?

 

FINALLY

It's Definitively not getting rid of rubbish-formatting in the cell who case this problem i think. Therefore must there be a command who delete all formatting before setting the wanted format.

 

Waiting 4 Your reply.

 

Sincerely

Lars Gunnar Nesseth