Results 1 to 36 of 36

Formula in a macro doesnt work for Spanish Excel user

Threaded View

  1. #18
    Registered User
    Join Date
    01-03-2013
    Location
    Indiana, US
    MS-Off Ver
    Microsoft 365
    Posts
    26

    Re: Formula in a macro doesnt work for Spanish Excel user

    I created the loop:
    Sub DateMod()
        Dim Temp    As Variant, _
            Prefix  As Variant, _
            Yr      As Variant, _
            Mnth    As String, _
            DayNum  As String, _
            DV      As Date
            
           Dim lastColumn As Long
           Dim i As Integer
           Dim sht As Worksheet
           
    Set sht = ThisWorkbook.Worksheets("Forecast")
    Range("D1").Select
     lastColumn = sht.Cells(1, sht.Columns.Count).End(xlToLeft).Column
    
     
     MsgBox lastColumn
      
        For i = 4 To lastColumn
        
        
        Temp = Split(Cells(1, i).Value, "\")
        Yr = Split(Temp(0), "-")
        Prefix = Yr(0)
        Yr = Yr(1)
        Temp = Split(Temp(1), " ")
        Mnth = Temp(1)
        DayNum = Left(Temp(0), Len(Temp(0)) - 2)
        DV = DateValue(DayNum & " " & Mnth & " " & Yr)
        Cells(2, i).Value = DV
        Next i
    End Sub
    This worked great for me but the user got a type mismatch this is what her screen looked like after running:

    10-30-2018 3-12-49 PM.jpg
    Rows 3 and 4 were not in date format previously.
    Last edited by nburton; 10-30-2018 at 03:23 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro which used to work, now doesnt -
    By Spyros13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2016, 02:08 PM
  2. Macro copy doesnt work right
    By vindalloo77 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-23-2016, 08:34 AM
  3. Excel macro vba - hide specific colums doesnt work due to merged cell
    By kilaz17 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2012, 11:24 AM
  4. My loop macro doesnt work
    By matdog in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2010, 02:32 AM
  5. [SOLVED] macro from excel 97 that doesnt work in excel 2003 (help)
    By thanhhuy27@gmail.com in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 10:10 AM
  6. some functions doesnt work in macro?
    By ExcelPower in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2006, 03:40 AM
  7. [SOLVED] Please help : Macro doesnt work on other PCs
    By Jason in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-26-2005, 05:55 AM

Tags for this Thread

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