excel - VBA + autocomplete date -


I have a variable (the value comes from the text box) which is the date in the date / mm / yay format. I want to fill cells automatically, but it changes the year instead of day. I know that it does not look as a date, but in the form of a string. But I could not find any way to do this. Here are some troutouts:

  SubTryout () 'results: 30/12/2015 30/12/2016 30/12/2017 30/12/2018 30/12/2016 30/12 / 2020 30/12/2021 30/12/2022 30/12/2023 Range ("A1") Value = "30/12/2015" Range ("A1"). Select the selection. Autofill destination: = range ("A1: I1"), type: = xlFillDefault 'results: 30/12/2015 30/12/2016 30/12/2017 30/12/2018 30/12/2016 30/12/2020 30/12/2021 30/12/2022 30/12/2023 Range ("A2") Value = "30/12/2015" Range ("A2"). Number format = "dd / mm / yyyy" range ("A2"). Select the selection .AutoFill Destination: = Category ("A2: I2"), Type: = xlFillDefault 'Results: 30/12/2015 30/12/2016 30/12/2017 30/12/2018 30/12 / 2019 30/12/2020 30/12/2021 30/12/2022 30/12/2023 Range ("A5") Value = Format ("30/12/2015", "dd / mm / yyyy") Category ( "A5"). Select the selection. AutoFill Destination: = Range ("A5: I5"), Type: = XLFil Default 'Results: 30/12/2015 31/12/2015 01/01/2016 02/01/2016 03/01/2016 04 / 01/2016 05/01/2016 06/01/2016 07/01/2016 Range ("A3") Number Format = "DD / MM / Yay" Category ("A3") CT selection AutoFill Destination: = Range ("A3: I3"), type: = xlFillDefault End sub  

is the last one I need, but no cell with value from Excel, But from a variable

I hope someone can give me some hints thanks in advance

Why are you entering a date in the range ("A1") as a string?

Try it and tell me if it helps:

  sub-sauce () range ("A1"). Value = date value ("30 / 12/2015") range ("A1"). Number format = "dd / mm / yay" and sub  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -