+ Reply to Thread
Results 1 to 2 of 2

How to copy some text in columns and rest in rows

  1. #1
    Greg
    Guest

    How to copy some text in columns and rest in rows

    Hi I have an excel table that has water quality data for numerous sites in
    about a dozen columns eg. pH, salinity, turbidity , to put it in a database I
    need to cut and paste it so that for each of these parameters, the site name,
    code and date/time is in the same row.
    Eg. Now it is: Site Code Date/Time pH Turbidity Salinity
    I would like:
    Site Code Date/Time pH
    Site Code Date/Time Turbidity
    Site Code Date/Time Salinity
    Any help would be very much appreciated.
    Thanks.
    Cheers,
    Greg

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Sub DBprep()
    Worksheets(1).Select
    j = 1
    For i = 2 To 4
    Worksheets(1).Select
    s = Cells(i, 1).Text
    c = Cells(i, 2).Value
    d = Cells(i, 3).Value
    p = Cells(i, 4).Value
    t = Cells(i, 5).Value
    s2 = Cells(i, 6).Value
    Worksheets(2).Select
    j = j + 1
    Cells(j, 1).Value = s
    Cells(j, 2).Value = c
    Cells(j, 3).Value = d
    Cells(j, 4).Value = p
    j = j + 1
    Cells(j, 1).Value = s
    Cells(j, 2).Value = c
    Cells(j, 3).Value = d
    Cells(j, 4).Value = t
    j = j + 1
    Cells(j, 1).Value = s
    Cells(j, 2).Value = c
    Cells(j, 3).Value = d
    Cells(j, 4).Value = s2
    Next
    End Sub
    Best regards,

    Ray

+ 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