PC Excel VBA Macro for Mac Excel 2011

Posted on 2011-05-06
Last Modified: 2012-05-11
I have a VBA Macro created on a PC in Excel VBA; that does not run on the Mac version of Excel 2011.  The error I get is on the "set rFine = " line...

Anyone know how I can get this macro to run on the Mac version of Excel 2011?

Sub FixDimension()
    Dim rFind As Range, sFind(), sReplace(), sOffset(), i As Long
    sFind = Array("Full Banner - 468 x 60", "Skyscraper - 120 x 600", "Medium Rectangle - 300 x 250", _
                  "Super Banner - 728 x 90", "GEOPOP - 1 x 1", "780x260 - 780 x 260", _
                  "Slider - 1 x 1", "Raw Click - 1 x 1", "Interstitial - 1 x 1", "Pixel/Popup - 1 x 1")
    sReplace = Array("468x60", "120x600", "300x250", "728x90", "GeoPop", "Bottom of Page", _
                     "Messenger Ad", "Raw Click", "Interstitial", "Pop Under")
    sOffset = Array("CPM", "CPM", "CPM", "CPM", "GeoPop", "CPM", "Messenger Ad", "Raw Click", "Interstitial", "Pop Under")
    With ActiveSheet.UsedRange
        For i = LBound(sFind) To UBound(sFind)
            Set rFind = .Find(What:=sFind(i), LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
            If Not rFind Is Nothing Then
                    rFind.Value = sReplace(i)
                    rFind.Offset(, -1) = sOffset(i)
                    Set rFind = .FindNext(rFind)
                Loop While Not rFind Is Nothing
            End If
        Next i
    End With

End Sub

Open in new window

Question by:adworldmedia
    LVL 29

    Expert Comment

    What is the Error and what is the value of sFind(i) when the error occurs?

    LVL 85

    Accepted Solution

    Change line 14 to:
    Set rFind = .Find(What:=sFind(i), LookAt:=xlWhole, MatchCase:=False)

    Open in new window


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
    How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
    This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now