+ Reply to Thread
Results 1 to 3 of 3

Error when updating links via VBA

Hybrid View

  1. #1
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327

    Error when updating links via VBA

    Hi all,

    I am doing some work for my brother which is an Excel workbook with some code attached to a control button.

    Essentially the code opens a named file and fills cells with data from another book.

    My problem is that the code works absolutely fine on my machine and yet when I send him the file the code falls over at the point shown below. With him the code halts and shows a dialog box asking where to update the links from:

    I have a variable already declared for "SourceFileCell"

    Sub FormatFileWithExtract()
    
    'Lots of code to do formatting of the current sheet etc etc etc
    
    '*****
    'Autofill formulae across and down to fill range
    '*****
        
        With Range("A2")
     CODE FALLS OVER AT THIS LINE       .FormulaR1C1 = "=IF(" & SourceFileCell & "= """",""""," & SourceFileCell & ")" ' 
            .AutoFill Destination:=Range("A2").Range("A1:J1"), Type:=xlFillDefault
            .Range("A1:J1").AutoFill Destination:=Range("A2").Range("A1:J19"), Type:=xlFillDefault
        End With
    Range("A1").Select
    
    '*****
    'Save the workbook
    '*****
    
    ActiveWorkbook.Save
    
    End Sub

    Can anyone possibly help and tell me why this code works fine with me but not with my brother when I send him the file.

    NB we both have the same files saved just to the root of c for simplicity. We both run WinXP and Office 2003.

    Any help would be much appreciated

    Regards

    Seamus

  2. #2
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Bump. Any help anyone, please?

    Seamus

  3. #3
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Bump. Sorry to bump this again, but can anyone give me any help with this one, please?

    Seamus

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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