Results 1 to 3 of 3

Find/Replace Cell Values with Named Ranges

Threaded View

  1. #1
    Registered User
    Join Date
    02-10-2010
    Location
    NYC
    MS-Off Ver
    Excel 2007
    Posts
    2

    Find/Replace Cell Values with Named Ranges

    Hi,

    I have a number of named ranges that I need to find/replace data in.

    For example, in range "PAPKGC" there are three variables: F, P, and X. For "F", the cell needs to contain the word "Flat". "P" is to contain "Package" and "X" is to be blank. Range "PASIDE" also contains 2 variables. I am to concatenate any cells with a value of 2 with "/pk" and any cells with a value of 1 are to be blank.

    So my big question is: How can I use the named ranges to find and replace this data using a VBA macro?

    This is what I'm trying, but I have no idea what I'm doing.
    Sub ReplaceText()
        Dim rngData As Range, rngCell As Range
             
        With ThisWorkbook
            Set rngData = Range("PAPKGC")
        End With
         'define the data range to evaluate
         
        For Each rngCell In rngData
            Select Case rngCell.Value
                Case "F"
                    cell.Value = "Flat"
                Case "P"
                    cell.Value = "Package"
            End Select
        Next rngCell
    End Sub
    Any help is appreciated!

    -G
    Last edited by Leith Ross; 02-10-2010 at 05:32 PM. Reason: Added Code Tags

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