Transpose Values VBA for week

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

I have a data set that is stored like this (I dont need total in output)

AreaDateMonTueWedThuFriSatSunTotal
Team 120-07-2014372032343524196
Team 127-07-204846364810216206
Team 220-07-203831421610103150
Team 227-07-2033151519314727187


How can i use VBA to transpose the information in a tabular format like below

AreaDateIncoming
Team 120/07/202014
Team 121/07/202037
Team 122/07/202020
Team 123/07/202032
Team 124/07/202034
Team 125/07/202035
Team 126/07/202024
Team 127/07/202048
Team 128/07/202046
Team 129/07/202036
Team 130/07/202048
Team 131/07/202010
Team 101/08/20202
Team 102/08/202016
Team220/07/202038
Team221/07/202031
Team222/07/202042
Team223/07/202016
Team224/07/202010
Team225/07/202010
Team226/07/20203
Team227/07/202033
Team228/07/202015
Team229/07/202015
Team230/07/202019
Team231/07/202031
Team201/08/202047
Team202/08/202027


My Sheet is called Data and the headings start from A1

Many Thanks
 
Source Data

AreaDateMonTueWedThuFriSatSunTotalIDType
Team 120-07-20434248935519193182005Mailing


Output format

DateAreaIncoming VolumeIDType
20-07-20Team 1432005Mailing
21-07-20Team 1422005Mailing
22-07-20Team 1482005Mailing
23-07-20Team 1932005Mailing
24-07-20Team 1552005Mailing
25-07-20Team 1192005Mailing
26-07-20Team 1192005Mailing
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi Again - Date formatted as date and numbers with no decimals - Thank You
 
Upvote 0
How about
VBA Code:
Sub mahmed()
   Dim Ary As Variant, Nary As Variant
   Dim r As Long, nr As Long, c As Long
   
   Ary = Sheets("Data").Range("A1").CurrentRegion.Value2
   ReDim Nary(1 To UBound(Ary) * UBound(Ary, 2), 1 To 5)
   
   For r = 2 To UBound(Ary)
      For c = 3 To 9
         nr = nr + 1
         Nary(nr, 2) = Ary(r, 1)
         Nary(nr, 1) = Ary(r, 2) + c - 3
         Nary(nr, 3) = Ary(r, c)
         Nary(nr, 4) = Ary(r, 11)
         Nary(nr, 5) = Ary(r, 12)
      Next c
   Next r
   With Sheets("Pastesheet").ListObjects("tblIncoming")
      .DataBodyRange.Delete
      .Parent.Range("A2").Resize(nr, 5).Value = Nary
   End With
End Sub
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top