+ Reply to Thread
Results 1 to 2 of 2

Auto update Invoice

  1. #1
    rough_terrain
    Guest

    Auto update Invoice

    I need to copy relevant information from an invoice across the page to named
    cells, and have the information move down a line each time, can anyone help
    me with the correct code. I have the code from an older version of Excel
    which works fine, but 2003 does not like it. HELP!!!!
    This is the old code:-

    clearsht (a)
    =FORMULA.GOTO("Start")
    =FORMULA.GOTO("invoice")
    =COPY()
    =FORMULA.GOTO("fst")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("date")
    =COPY()
    =FORMULA.GOTO("sec")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("Job_Site")
    =COPY()
    =FORMULA.GOTO("trd")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("gst")
    =COPY()
    =FORMULA.GOTO("forth")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("invoice_total")
    =COPY()
    =FORMULA.GOTO("fth")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("fst")
    =COPY()
    =FORMULA.GOTO("num")
    =PASTE.SPECIAL(3,1,FALSE,FALSE)
    =FORMULA.GOTO("gst")
    =CLEAR(1)
    =FORMULA.GOTO("Job_Site")
    =CLEAR(1)
    =FORMULA.GOTO("date")
    =CLEAR(1)
    =FORMULA.GOTO("fst")
    =DELETE.NAME("fst")
    =DELETE.NAME("sec")
    =DELETE.NAME("trd")
    =DELETE.NAME("forth")
    =DELETE.NAME("fth")
    =DELETE.NAME("sixth")
    =SELECT("R[1]C[0]")
    =DEFINE.NAME("fst")
    =SELECT("R[0]C[1]")
    =DEFINE.NAME("sec")
    =SELECT("R[0]C[1]")
    =DEFINE.NAME("trd")
    =SELECT("R[0]C[1]")
    =DEFINE.NAME("forth")
    =SELECT("R[0]C[1]")
    =DEFINE.NAME("fth")
    =SELECT("R[0]C[1]")
    =DEFINE.NAME("sixth")
    =SELECT("R[0]C[1]")
    =FORMULA.GOTO("start")
    =RETURN()




  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Rough_Terrrain,

    I saw your post and I decided to translate the macro from Excel 4.0 to more modern Excel VBA code. I am probably one of the few people who still has all the Excel 4.0 manuals. Your thread was post here at Excel Forum automatically. Unfortunately, I can't access your thread. The hope is some good soul will see this and possibly forward this code on. Here is the updated macro. If you need further assistence, e-mail me at LeithRoss@aol.com.
    _________________________________________________________________

    Public Sub MyMacro()

    Dim N As Long
    Dim SheetName As String
    Dim CopyCell As String
    Dim PasteCell As String

    SheetName = "=" & ActiveSheet.Name & "!"

    CopyCell = "invoice"
    PasteCell = "fst"
    GoSub CopyPaste

    CopyCell = "date"
    PasteCell = "sec"
    GoSub CopyPaste

    CopyCell = "Job_Site"
    PasteCell = "trd"
    GoSub CopyPaste

    CopyCell = "gst"
    PasteCell = "forth"
    GoSub CopyPaste

    CopyCell = "invoice_total"
    PasteCell = "fth"
    GoSub CopyPaste

    CopyCell = "fst"
    PasteCell = "num"
    GoSub CopyPaste

    With ActiveSheet
    .Range("gst").Clear
    .Range("Job_Site").Clear
    .Range("date").Clear
    End With

    ActiveSheet.Range("fst").Offset(1, 0).Select

    Names(, "fst").RefersTo = SheetName & ActiveCell.Offset(0, 0).Address
    Names(, "sec").RefersTo = SheetName & ActiveCell.Offset(0, 1).Address
    Names(, "trd").RefersTo = SheetName & ActiveCell.Offset(0, 2).Address
    Names(, "forth").RefersTo = SheetName & ActiveCell.Offset(0, 3).Address
    Names(, "fth").RefersTo = SheetName & ActiveCell.Offset(0, 4).Address
    Names(, "sixth").RefersTo = SheetName & ActiveCell.Offset(0, 5).Address

    ActiveSheet.Range("start").Select

    Exit Sub

    CopyPaste:
    With ActiveSheet
    .Range(CopyCell).Copy
    .Range(PasteCell).PasteSpecial Paste:=xlPasteValues, Operation:=xlPasteSpecialOperationNone
    End With
    Return

    End Sub

    _________________________________________________________________

    Hope this helps,
    Leith Ross

+ 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