Results 1 to 8 of 8

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

Threaded View

  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 .
    Private Sub CommandButton1_Click()
    With Sheets("sheet1")
    .Range("a2").CurrentRegion.ClearContents
    
    If OptionButton1.Value = True Then
    
    .Range("A" & .Rows.Count).End(xlUp).Offset(0).Resize(ListBox1.ListCount, 6) = ListBox1.List
      
        ElseIf OptionButton2.Value = True Then
    
    .Range("A" & .Rows.Count).End(xlUp).Offset(0).Resize(ListBox1.ListCount, 6) = ListBox1.List
        .Columns(1).NumberFormat = " General"
        
    End If
    
    End With
    
    Sheets("sheet1").Range("a1").CurrentRegion.PrintOut
    End Sub
    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

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