Results 1 to 6 of 6

Issue with recorded macro in Excel

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2015
    Location
    Dublin, Ireland
    MS-Off Ver
    Office 2013
    Posts
    29

    Issue with recorded macro in Excel

    Hi, I have macros which are stored in Personal.xlsb

    I recently created a new one using "Record Macro".

    When I run the macro it errors. The reason is that in several steps, it refers to a filename specifically (and the file being used is a different name)

    How do I change the code so that it will work with any file?

    Tommy

    Example:
    ActiveWorkbook.Worksheets("Transaction_Export_16.11.2021_0").Sort.SortFields. _
            Clear
        ActiveWorkbook.Worksheets("Transaction_Export_16.11.2021_0").Sort.SortFields. _
            Add2 Key:=Range("D2:D1001"), SortOn:=xlSortOnValues, Order:=xlAscending, _
            DataOption:=xlSortNormal
        With ActiveWorkbook.Worksheets("Transaction_Export_16.11.2021_0").Sort
    Last edited by butterscotch; 11-17-2021 at 12:08 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro recorded with errors in Excel VBA
    By gtg430i in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-11-2020, 05:39 PM
  2. [SOLVED] Issue regarding recorded Macro to transfer data from Input sheet to Storage sheet
    By Hirad001 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-29-2015, 04:26 PM
  3. [SOLVED] Need to take off Recorded Macro which minimizes the Excel program
    By cesarmontoya in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2013, 02:30 PM
  4. [SOLVED] Recorded Pivot Table Macro Doesn't Do What I Recorded!
    By diakonos1984 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-26-2013, 11:01 AM
  5. [SOLVED] excel 2007 chart macro graphs data only from sheet on which macro was recorded
    By JW1028 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-19-2013, 06:33 PM
  6. Adding vlookup value in excel recorded macro
    By peednaswan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2012, 03:57 AM
  7. Excel VBA error-recorded a macro to sort
    By Leena in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-13-2005, 11:06 AM

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