Results 1 to 1 of 1

Userform Date Swapping Issue

Threaded View

  1. #1
    Registered User
    Join Date
    01-13-2016
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Userform Date Swapping Issue

    I have a userform that searches for a particular row on my spreadsheet. It then allows me to update the data using the necessary textboxs and then update that specific row by clicking a button. All seems to be working fine, except the date text boxes, which are swapping the day and month fields. (e.g. 01/02/1999 becomes 02/01/1999). I had a similar problem on another sheet and fixed this problem using CDate, however I cannot seem to get this to work for this instance.

    Below is the code I am using to "update" the spreadsheet and the specific lines causing me issues are "ws.Cells(r.Row, 12).value = txtCriticalDate.Text" and "ws.Cells(r.Row, 15).value = txtCompleteDate.Text"

    Any help on this would really be appreciated.



    Private Sub cmdUpdate_Click()
          
        
        Dim r As Range
         
        Set ws = Worksheets("Opportunities")
        
        Set r = ws.Range("A:A").Find(what:=txtJobRef.Text, LookAt:=xlWhole, MatchCase:=False)
         
        If Not r Is Nothing Then
        Application.Calculation = xlCalculationManual
             '// Get value in cell r.row, column 2 into textbox2
          ws.Cells(r.Row, 1).value = txtJobRef.Text
          ws.Cells(r.Row, 2).value = txtCommodity.Text
          ws.Cells(r.Row, 3).value = txtSupplier.Text
          ws.Cells(r.Row, 4).value = txtCat1.Text
          ws.Cells(r.Row, 5).value = txtCat2.Text
          ws.Cells(r.Row, 6).value = txtOwner.Text
          ws.Cells(r.Row, 7).value = txtBusDept.Text
          ws.Cells(r.Row, 8).value = txtSource.Text
          ws.Cells(r.Row, 9).value = txtProcRoute.Text
          ws.Cells(r.Row, 10).value = txtPlanned.Text
          ws.Cells(r.Row, 11).value = txtEstValue.Text
          ws.Cells(r.Row, 12).value = txtCriticalDate.Text
          ws.Cells(r.Row, 13).value = txtLiveLink.Text
          ws.Cells(r.Row, 14).value = txtStatus.Text
          ws.Cells(r.Row, 15).value = txtCompleteDate.Text
          ws.Cells(r.Row, 16).value = txtWinSup.Text
          ws.Cells(r.Row, 17).value = txtActValue.Text
          ws.Cells(r.Row, 18).value = txtRoute.Text
          ws.Cells(r.Row, 19).value = txtComments.Text
          Application.Calculation = xlCalculationAutomatic
      
    
        End If
         
         
    End Sub

    ~~SOLVED~~

    Posted literally 2 minutes too soon and worked it out. For anyone with a similar issue,
    ws.Cells(r.Row, 12).value = CDate(Me.txtCriticalDate.Value)
    worked
    Last edited by stevefisher85; 08-22-2016 at 07:57 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Rowsource or any other value (date issue) + refer to other userform
    By mariec_06 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2016, 11:40 PM
  2. Replies: 0
    Last Post: 11-16-2015, 08:57 AM
  3. UserForm Date Formatting Issue
    By DomSza in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-16-2015, 10:00 AM
  4. [SOLVED] Userform two way issue
    By af25 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-27-2014, 04:22 AM
  5. [SOLVED] VBA Userform date format issue - dd/mm/yyyy
    By JamesFinch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2014, 08:03 AM
  6. [SOLVED] VBA code swapping date formats??
    By cjimmy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2012, 06:09 AM
  7. Userform Tab Issue
    By kortex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-18-2012, 02:28 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