+ Reply to Thread
Results 1 to 3 of 3

Code running on one computer but not on another

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Code running on one computer but not on another

    Hi all

    I have the following code which then later calls another Macro to build a report but the first doesn't work on a colleagues computer.
    We both use Excel 2013, Windows 7, same Tools > References checked and the file is in a shared drive folder which we both have access to.
    Sheets("csv1").Activate
    wb2 = Application.GetOpenFilename _
        (Title:="Please choose CSV to import")
    If wb2 = False Then
    MsgBox "No file opened", vbInformation, "No file opened"
    Exit Sub
    Else
    Workbooks.Open Filename:=wb2
    End If
    Application.ScreenUpdating = False
    Set wbtwo = ActiveWorkbook
        Range("DM:DN,DP:DQ,DS:DT,DV:DW,A:C,E:Y,AA:AB,AD:AE,AG:AH,AJ:AK,AM:AN,AP:AQ,AS:AT,AV:AW,AY:AZ,BB:BC,BE:BF,BH:BI,BK:BL,BN:BO,BQ:BR,BT:BU,BW:BX,BZ:CA,CC:CD,CF:CG,CI:CJ,CL:CM,CO:CP,CR:CS,CU:CV,CX:CY,DA:DB,DD:DE,DG:DH,DJ:DK").Select
        Selection.Delete Shift:=xlToLeft
        Range("A1").Select
        Selection.End(xlDown).Select
        CSVEndRow = Split(ActiveCell(1).Address(1, 0), "$")(1)
        Range("A1").Select
        Selection.End(xlToRight).Select
        CSVEndCol = Split(ActiveCell(1).Address(1, 0), "$")(0)
        Range("A1:" & CSVEndCol & CSVEndRow).Select
        Selection.Copy
        Workbooks("SS").Sheets("CSV1").Activate
        Range("A1").Select
        Selection.PasteSpecial xlPasteValues
    Application.DisplayAlerts = False
    wbtwo.Close
    Application.DisplayAlerts = True
    Range("A1").Select
    For Each x In Range("A1:A" & CSVEndRow)
    x.Value = WorksheetFunction.Proper(x.Value)
    Next x
    With Application.SpellingOptions
        .SuggestMainOnly = True
        .IgnoreCaps = True
    End With
    With Range("A1:A" & CSVEndRow)  
        Call .CheckSpelling         
    End With                        
    'Exit Sub
    Dim ccount As Integer
    ccount = 0
    '-----------------------------------------------------------------------
    For Each x In Range("A2:A" & CSVEndRow)
    x.Value = Trim(x.Value)
    If x.Value = "Line Manager" Then
        GoTo Skipx
        Else
        If x.Value = "Manager" Then
        x.Value = "Line Manager"
        GoTo Skipx
        Else
            If x.Value = "Direct Report" Then
            GoTo Skipx
            Else
                If x.Value = "Self Assessment" Then
                GoTo Skipx
                Else
                    If x.Value = "Self" Then
                    x.Value = "Self Assessment"
                    GoTo Skipx
                    Else
                        If x.Value = "Colleague" Then
                        GoTo Skipx
                        Else
                            If x.Value = x & " " Then
                            GoTo Skipx
                            Else
                            x.Interior.ColorIndex = 8
                            ccount = ccount + 1
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End If
    Skipx:
    Next x
    If ccount >= 1 Then
    Application.ScreenUpdating = True
    MsgBox (ccount & " errors found." & vbNewLine & "Please amend before continuing")
    Sheets("csv1").Activate
    Range("A1").Value = "Press CTRL + SHIFT + S to resume"
    MsgBox ("Please press CTRL + SHIFT + S to resume")
    Exit Sub
    Else
    Call SS2
    End If
    It doesn't seem to call the second Macro, but doing CTRL + F8 through the code makes it work fine.

    Any help on this one is greatly appreciated
    Last edited by Aaron092; 07-22-2015 at 03:56 AM. Reason: Removing notes

  2. #2
    Forum Contributor prabhuduraraj09's Avatar
    Join Date
    05-19-2012
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    330

    Re: Code running on one computer but not on another

    Hi,

    Hope you are referring to the below !!
    Call .CheckSpelling
    Please re check if the dot prefixing the checkspelling is required or not. Guess that's blocking to proceed.

  3. #3
    Forum Contributor
    Join Date
    01-30-2014
    Location
    England
    MS-Off Ver
    MS Office 2010, 2007, 2003
    Posts
    149

    Re: Code running on one computer but not on another

    Hi prabhuduraraj09

    Where it said fix, those were just notes to myself. Sorry for any confusion.
    CheckSpelling is needed as in the second macro, the text needs to be perfect for it to work properly so users need to check that everything is spelt correctly.

+ 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. [SOLVED] Creating a workbook on a computer with a reference then running on another without?
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-28-2014, 09:30 AM
  2. Code running in the background- crashing computer, what is this??
    By KATIEexcel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-30-2012, 05:44 AM
  3. [SOLVED] Error 1004 when running macro on a different computer
    By Coalsand in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-27-2012, 11:16 AM
  4. Strange thing only on one Computer running this XLS
    By johnnywinter in forum Excel General
    Replies: 3
    Last Post: 02-08-2009, 11:31 PM
  5. Better computer specs for running excel
    By chris100 in forum Excel General
    Replies: 0
    Last Post: 10-09-2006, 02:05 PM
  6. [SOLVED] running excel macros on remote computer
    By TxRaistlin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-10-2005, 03:05 AM
  7. Problem with running macro on Mac computer
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2005, 04:05 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