Results 1 to 4 of 4

macro worked when rec'd but not when run

Threaded View

  1. #1
    Registered User
    Join Date
    03-14-2007
    Location
    Buckinghamshire, England
    MS-Off Ver
    Professional 2010 14.0.5128.5000
    Posts
    32

    Question macro worked when rec'd but not when run

    Hi, can you help please? I have recorded a macro and it did exactly what I required when it was recorded, yet when I run it again the results are not the same.

    I want to identify occurances of '77' in column M and when found set the contents of column K to 'emeropid'.

    What I recorded was :-
    select 1st row and turned on auto-filter.
    selected '77' from autofilter dropdown.
    selected the column K cell of the first result and changed it to 'emeropid'
    copied that cell to the other rows identified by the auto filter.

    When I stopped recording and turned off the autofilter the results were exactly as planned - any row with 77 in column M had 'emeropid' on column K.

    To test it I replaced the entire Column K with the original unchanged data and ran the Macro. It did not make any changes at all. I don't understand why not, or how I can achieve what I'm trying to.

    The macro I recorded looks like this.

    '
    Rows("1:1").Select
    Range("C1").Activate
    Selection.AutoFilter
    ActiveWindow.LargeScroll ToRight:=1
    Selection.AutoFilter Field:=13, Criteria1:="77"
    Range("K5").Select
    ActiveCell.FormulaR1C1 = "metpol.emeropid"
    Range("K5").Select
    Selection.FillDown
    ActiveWorkbook.Save
    End Sub

    Any help would be appreciated.
    Pete
    Last edited by Woolmep; 10-23-2009 at 08:10 AM. Reason: problem solved

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