How to copy some text in columns and rest in rows

G

Greg

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
 
R

raypayette

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
 
Top