Flux rss
Search : in
By : Relevance Date Username
Statut : Not resolved

Excel Macro Help Needed

jembuoy, on Wednesday 23 July 2008 à 06:53:07
Hello Everyone!

I hope you can help me with this...

I have this in my data let's say on column A:

John Doe
1234 Good St
ATHERTON 94027
650/123-1234
Fax: 650/123-1235
Email: johndoe@gmail.com
web: www.johndoe.com

Jane Doe
1234 Bad St
ATHERTON 94027
650/123-1236
Email: johndoe@gmail.com
web: www.johndoe.com

Then I want them to be transferred/modified horizontally on the same worksheet but on different columns with headers:

Name Street City and ZC Phone Number Fax email web

How do I do it with macros, considering that every bundle of data per person has different row counts (some have phone number some dont) and they are all separated by a row (in excel).

I hope you can help me please.

Jeremy
Configuration: Windows XP
Firefox 2.0.0.16
Reply to jembuoy  Report this message to moderators Go to last message

1


  • 1
    This message seems useful, vote!
  • Ce message ne vous semble pas utile, votez !
  • Report this message to moderators
Ivan-hoe, on Thursday 24 July 2008 à 06:38:31
Hello Jeremy,
the macro below could do nicely, but with no guarantee
each line in a bundle of data has to be identified to determine in which column it has to be transferred :
- if it contains a header word followed by colon (Fax: Web:) , this header word is used for identification
- for lack of a header, it is considered that each line will be transferred horizontally in the same order (i.e. name / address / city / phone number). If it is not true, then we'll have to review our plans.
Ivan
Sub Jembuoy()
    Dim LastLine As Integer, i As Integer, ColNbr As Integer
    Dim DataColumn As String
    Dim FirstHeaderColumn As Integer
    Dim MyCell As Range
    Dim Table
    
    Sheets("Data").Activate 'sheet that contains the data
    DataColumn = "A" 'column that contains the data
    FirstHeaderColumn = 4 'number of the first column that contains a header ("Name")

    LastLine = Cells(Rows.Count, DataColumn).End(xlUp).Row
    Range(DataColumn & "1:" & DataColumn & LastLine).Select
    For Each MyCell In Selection
        If MyCell.Value = Empty Then
            i = 0
        Else
            i = i + 1
            
            Table = Split(MyCell.Value, ":")
            Select Case LCase(Table(0))
                Case Is = "phone": ColNbr = 4
                Case Is = "fax": ColNbr = 5
                Case Is = "email": ColNbr = 6
                Case Is = "web": ColNbr = 7
                Case Else: ColNbr = i
            End Select
            
            If ColNbr = 1 Then
                LastLine = Cells(Rows.Count, FirstHeaderColumn).End(xlUp).Row + 1
            End If
            Cells(LastLine, FirstHeaderColumn - 1 + ColNbr) = MyCell.Value
        End If
    Next MyCell

End Sub
Reply to Ivan-hoe

2


  • This message seems useful, vote!
  • Report this message to moderators
jembuoy, on Thursday 24 July 2008 à 09:51:42
Dear Ivan- hoe,

Got your message and will try at home. I will send you a feedback once I've tested this but for now please accept my huge thanks and appreciation!

Jeremy
Reply to jembuoy

3


  • This message seems useful, vote!
  • Report this message to moderators
 Jamie, on Friday 17 October 2008 à 17:34:40
Im doing the exact same thing, except I dont understand the instructions!!! heeelllpppp
Reply to Jamie

Résultats pour Excel Macro Help Needed

Excel Macro for deleting rows IF cells not... Hello, I need help to create a Excel macro. Basicly what I have is a sheet full with information about different departments and what I want to do is delete every row EXCEPT the rows that contain some specified values (wich i would like to enter on... en.kioskea.net/forum/affich-12620-excel-macro-for-deleting-rows-if-cells-not
Excel Macro Help please I need help with an excel macro that will take a username (string) in the first column and look at everytime that they either have an P (present), T (tardy), E (Excused), or A (absent) in a second column. They will be given 400 points if they were... en.kioskea.net/forum/affich-33502-excel-macro-help-please
Excel Macro I need help with an excel macro that will take a username (string) in the first column and look at everytime that they either have an P (present), T (tardy), E (Excused), or A (absent) in a second column. They will be given 400 points if they were... en.kioskea.net/forum/affich-33540-excel-macro

Résultats pour Excel Macro Help Needed

To insert an image in the FAQTo insert an image in the FAQ Method Where to find images? Inserting screenshots can help to understand an explanation. Here is how to improve tips on Kioskea (FAQ). For this trick, we opted to use the site Imageshack.us. Note:... en.kioskea.net/faq/sujet-67-to-insert-an-image-in-the-faq
How to open/read a .RBS file!How to open/read a .RBS file! RBS is a file extension describing Rebirth files Song files. It is a common error associated with many file extension errors. This method allows skip over programs that are not recognized and continue process. If... en.kioskea.net/faq/sujet-379-how-to-open-read-a-rbs-file

Résultats pour Excel Macro Help Needed

Excel Macro Help neededI need help with an excel macro that will take a username (string) in the first column and look at everytime that they either have an P (present), T (tardy), E (Excused), or A (absent) in a second column. They will be given 400 points if they were... en.kioskea.net/forum/affich-33099-excel-macro-help-needed
Error In ExcelHello, I recently wrote a fairly complex Excel Macro and have been trying just to work some of the bugs out of it for the past couple weeks. The most recent problems that i've run into is that when it is loaded on to the computer for a while it... en.kioskea.net/forum/affich-20216-error-in-excel
Macros_HelpHello Sir, I am working with Excel Macros using VB for the First time .Please Help me slove the following: I have a input file input.xls with the First column having file names I have to Search through and the Next x Columns has specific words I have... en.kioskea.net/forum/affich-25876-macros-help

Résultats pour Excel Macro Help Needed

Spreadsheets - The Excel Interface Microsoft Excel is the spreadsheet in the Microsoft Office office suite. To start it, simply click on the appropriate icon in the Start menu (in Windows) or click on an Excel file (that has an .xls file extension). A Excel document is called a file... en.kioskea.net/tableur/tabinterface.php3
Email - Rules for proper email use Netiquette (a contraction of the words "Net" and "etiquette") refers to the set of rules governing correct behaviour on the Internet, in order to respect others and be respected in turn. They serve as guidelines for civility and proper conduct, so... en.kioskea.net/courrier-electronique/regles-bon-usage-messagerie.php3
Spreadsheets - Cell Selection Spreadsheets are powerful tools for working with data. However, to work with data, it is necessary to have tools to rapidly choose the required cells. An entire line can be chosen by clicking directly on the line header: It is also possible to choose... en.kioskea.net/tableur/tabcellselect-1.php3