+ Reply to Thread
Results 1 to 21 of 21

How do I extract a 5 digit zip code from a column that may have a random number of text?

Hybrid View

  1. #1
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,112

    Re: How do I extract a 5 digit zip code from a column that may have a random number of tex

    Assuming that your data is in column A and that the word "ZIP" is somewhere in that column, try the following macro:
    Sub FindZip()
        Application.ScreenUpdating = False
        Dim foundZip As Range
        Dim SplitZip As Variant
        Set foundZip = Range("A:A").Find("ZIP", LookIn:=xlValues, lookat:=xlPart)
        If Not foundZip Is Nothing Then
            SplitZip = Split(foundZip, ":")
            MsgBox SplitZip(1)
        End If
        Application.ScreenUpdating = True
    End Sub
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  2. #2
    Registered User
    Join Date
    05-10-2016
    Location
    United States
    MS-Off Ver
    2013
    Posts
    12

    Re: How do I extract a 5 digit zip code from a column that may have a random number of tex

    I am brand new with macros, so I am not entirely sure how to run this.

    I selected macros on the upper left, then created the macro by copying and pasting your code. Since the zip codes are in column D, I changed A to D instead. After I save the macro file, I am not too sure how to run and test it.

    I would ultimately want the zip codes inputted to a brand new column on the right.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 03-19-2016, 01:11 AM
  2. Replies: 6
    Last Post: 08-31-2015, 03:08 PM
  3. [SOLVED] 5-digit Random Unique Alphanumeric Code
    By mcodden in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-15-2015, 04:32 PM
  4. [SOLVED] 5-digit Random Unique Alphanumeric Code
    By mcodden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-15-2015, 02:39 PM
  5. [SOLVED] extract 10 digit number only from text string
    By visha_1984 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 02-06-2015, 09:42 AM
  6. [SOLVED] VBA to convert cell to text and ensuring 7 digit number all along in entire column.
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-19-2013, 09:35 AM
  7. Random 8 digit number?
    By KennyS in forum Excel General
    Replies: 6
    Last Post: 08-21-2006, 01:30 PM

Tags for this Thread

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