+ Reply to Thread
Results 1 to 8 of 8

change column from date to number format and opposite after copy from form

  1. #1
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    395

    change column from date to number format and opposite after copy from form

    Hello
    I have this code to copy data from listbox to sheet . in first column in listbox contains date will be like this DD/MM/YYYY, then will show DATE in column A and it's ok ,but my problem when select optionbutton1 or optionbutton2 and populate numbers in first column like this 1,2,3 in listbox .... then should copy to column A like this 1,2,3.... but the problem will show like this 45155(DATEVALUE) .
    so I want when copy data from listbox date in first column then should show date in column A , if when copy data from listbox numbers in first column then should show number in column A like this 1,2,3 .
    Please Login or Register  to view this content.
    also posted here
    https://www.mrexcel.com/board/threads/change-column-from-date-to-number-format-and-opposite-after-copy-from-form.1243350/
    thanks
    Attached Files Attached Files
    Last edited by MKLAQ; 08-28-2023 at 01:26 PM. Reason: attachment

  2. #2
    Registered User
    Join Date
    07-25-2023
    Location
    AUstralia
    MS-Off Ver
    2021
    Posts
    14

    Re: change column from date to number format and opposite after copy from form

    Can you not just run a macro after you copy the data to reset it to the appropriate format ?

    Something like this

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    395

    Re: change column from date to number format and opposite after copy from form

    why I should use two codes? !
    by the way I don't see about formatting of number .

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: change column from date to number format and opposite after copy from form


    Hello,

    as an Excel date is stored as a number then within your ListBox you must use the cell Text property to have the same display layout.

    For further help if really necessary then attach at least your workbook …

  5. #5
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    395

    Re: change column from date to number format and opposite after copy from form

    within your ListBox you must use the cell Text property to have the same display layout.
    do you mean like this ?
    Please Login or Register  to view this content.
    well, doesn't work for me and I attached file .
    when you click optionbutton1 will match with sheet name and populate data in listbox and when click command button1 should copy to sheet1 based on the same formatting in listbox based on DATE or numbers .

  6. #6
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: change column from date to number format and opposite after copy from form

    You haven't set the date format ... try this:
    Please Login or Register  to view this content.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  7. #7
    Forum Contributor
    Join Date
    02-08-2021
    Location
    africa
    MS-Off Ver
    2016
    Posts
    395

    Re: change column from date to number format and opposite after copy from form

    Hi MatrixMan ,
    your suggestion works for me greatly !
    thank you so much .

  8. #8
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: change column from date to number format and opposite after copy from form

    You're welcome and thank you for the rep point :-)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to change Pivot Chart axis number format to a custom date format
    By paulma1960 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-11-2023, 03:16 PM
  2. Convert forced change of date to String or Text format back to Date format in a column
    By analystbank in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-20-2022, 09:17 AM
  3. Replies: 2
    Last Post: 12-05-2019, 10:40 AM
  4. [SOLVED] VBA To change Date format in Column A and Copy a cell if it contains specific Text
    By zaska in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-10-2016, 10:45 AM
  5. Show Error when a cell with number format change to date format
    By delroba in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2015, 02:57 AM
  6. Change backwards number format to date format
    By vickie10200 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-10-2013, 01:32 PM
  7. copy a number typed in a cell to another & change it to word form.
    By ex:1 in a cell = one in a different cell in forum Excel General
    Replies: 1
    Last Post: 04-20-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1