Solved

VBA Solution For Extracting Data From A Spreadsheet

Posted on 2013-12-29
2
269 Views
Last Modified: 2013-12-30
Hi,

I have a spreadsheet attached that has multiple lines in Column A (this is just a sample as there are several cells continuing down Column A)

Each cell does have this data:

Primary Contact Information
Name: Jane Doe
Preferred Method of Contact:
Email: test@domain.com
Phone: (212)555-1212
Best Time to Contact: Any Time
Cell Phone:
Best Time to Contact: Any Time
Address:
,
Budget : $400.00
Best way to contact me? :
How soon to make a decision? :
Indoor or outdoor event? : indoors without stairs

I want to get the Name and Email from each cell and put the name in Column B and email in Column C
Like-This.xlsx
0
Comment
Question by:Computer Guy
2 Comments
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 39744809
Is this what you want ? I copied and modified some of your cells downward just to make sure test is ok. Make sure macros are activated and check out the results. Press on the button in sheet1

Let me know
gowflow
Like-This.xlsm
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39744816
If gowflow's solution is essentially the same as this macro then please give him all the credit.

Sub GetData()

Dim lngRow As Long
Dim intPosStart As Integer
Dim intPosEnd As Integer

For lngRow = 1 To ActiveSheet.UsedRange.Rows.Count
    intPosStart = InStr(1, Cells(lngRow, 1).Value, "Name:")
    intPosStart = intPosStart + 6
    intPosEnd = InStr(intPosStart, Cells(lngRow, 1).Value, "Preferred")
    Cells(lngRow, 2).Value = Mid(Cells(lngRow, 1).Value, intPosStart, intPosEnd - intPosStart)
    
    intPosStart = InStr(1, Cells(lngRow, 1).Value, "Email:")
    intPosStart = intPosStart + 7
    intPosEnd = InStr(intPosStart, Cells(lngRow, 1).Value, "Phone")
    Cells(lngRow, 3).Value = Mid(Cells(lngRow, 1).Value, intPosStart, intPosEnd - intPosStart)

Next
End Sub

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Web Query 1 20
Transposing this formula ... 5 12
Excel Macro 9 18
vba copy paste previous line 3 14
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

856 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