+ Reply to Thread
Results 1 to 4 of 4

?making 4 columns 1 w/ refrences?

Hybrid View

  1. #1
    Registered User
    Join Date
    07-03-2007
    Location
    Baghdad, Iraq
    Posts
    2
    sorry about the confusion. You assume correctly. I have attached a sample datasheet.
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by rockstar
    sorry about the confusion. You assume correctly. I have attached a sample datasheet.
    OK - create a macro, and set the code as
    Sub SetLines()
    Dim iRow As Long, iLastRow As Long, iColumn As Long
    iLastRow = ActiveSheet.Range("A65536").End(xlUp).Row
    For iRow = iLastRow To 2 Step -1
        For iColumn = 3 To 6
        If Not Cells(iRow, iColumn).Value = "" Then
            Rows(iRow + 1).EntireRow.Insert
            Cells(iRow + 1, 1).Value = Cells(iRow, iColumn).Value
            Cells(iRow + 1, 2).Value = Cells(iRow, iColumn + 4).Value
            End If
            Next
        Next
    End Sub
    you could then set the macro options to allow a Shortcut key (say CTRL/Shift/S) and run the macro by pressing ctrl/shift/s.

    The macro does not check the sheet name, be carefull of destroying other sheets. The macro is not fully tested, try it out AFTER saving a copy of your data.

    The macro does not clear the cells from which the data came, you may want to add
          Cells(iRow, iColumn).Value = ""
          Cells(iRow, iColumn + 4).Value = ""
    immediately before the EndIf

    hth
    ---

    added

    you might prefer to use

    For iColumn = 6 To 3 Step -1

    to sequence correctly.
    ---
    Last edited by Bryan Hessey; 07-07-2007 at 02:08 AM.
    Si fractum non sit, noli id reficere.

+ Reply to Thread

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