ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   dget and dsum (https://www.excelbanter.com/excel-discussion-misc-queries/206517-dget-dsum.html)

Henry

dget and dsum
 
shift 1 shift 2 shift 3
1/1/2008 32 45 28
1/2/2008 49 36 73
1/3/2008 21 16 81

Have data as above and would like to make it as below:
1/1/2008 32
1/1/2008 45
1/1/2008 28
1/2/2008 49
1/2/2008 36
1/2/2008 73

Have 270 plus lines of data and have been trying to use dget but
can't seem to get it to work

Stefi

dget and dsum
 
Try this macro (create Sheet2 before running!):

Sub test()
Dim sourcerng As Range, sourcecell As Range, oneRow As Range, destrng As
Range
Worksheets("Sheet1").Select
NoofRows = Range("A" & Rows.Count).End(xlUp).Row
Set sourcerng = Range("A2:A" & NoofRows)
destrow = 2
For Each sourcecell In sourcerng
Set oneRow = Range(Range("B" & sourcecell.Row), Range("D" &
sourcecell.Row))
oneRow.Copy
Worksheets("Sheet2").Select
Set destrng = Worksheets("Sheet2").Range(Range("A" & destrow),
Range("A" & destrow + 2))
destrng.Value = sourcecell.Value
Range("B" & destrow).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Worksheets("Sheet1").Select
destrow = destrow + 3
Next sourcecell
Application.CutCopyMode = False
End Sub


Regards,
Stefi

Henry ezt *rta:

shift 1 shift 2 shift 3
1/1/2008 32 45 28
1/2/2008 49 36 73
1/3/2008 21 16 81

Have data as above and would like to make it as below:
1/1/2008 32
1/1/2008 45
1/1/2008 28
1/2/2008 49
1/2/2008 36
1/2/2008 73

Have 270 plus lines of data and have been trying to use dget but
can't seem to get it to work



All times are GMT +1. The time now is 09:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com