Please refer to attached file.
I have monthly data as shown.
I need to convert these data in Tabular format as shown in Sheet "TableFormat" Column I thru K.
Do not need data for cell which is blank.
SO basically need to go thru all months tab and go thru each day in column A.
Re: VB Code to convert sheet data into tabular format
This may not be useful either however as the post has been here a few days I thought I would offer.
Power Query, which I believe to be an Add-in for the 2010 version was used to make the following:
1. Convert the ranges to tables
2. load the tables one at a time into Power Query and paste the following* in the advanced editor:
*Note that in the first line the name of the table will need to be changed each time i.e. from tbl_Jan_2018 to tbl_Feb_2018
3. Choose Close and Load To: and then connection only
4. Once you have made connections to all tables you can then use the Append feature (For the 2019 version select Get Data then Combine Queries then Append)
5. Choose Close and Load.
Let us know if you have any questions.
Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.
A starter demonstration to paste to the TableFormat worksheet module :
PHP Code:
Sub Demo1() Dim L&, Ws As Worksheet, W, V(), N&, R&, C% L = 2 For Each Ws In ThisWorkbook.Worksheets If Not Ws Is Me Then W = Ws.[A1].CurrentRegion.Value ReDim V(1 To (UBound(W, 2) - 2) * (UBound(W) - 1), 2) N = 0 For R = 2 To UBound(W) If W(R, 1) Then For C = 3 To UBound(W, 2) If W(R, C) Then N = N + 1: V(N, 0) = W(R, 1): V(N, 1) = W(1, C): V(N, 2) = W(R, C) Next End If Next Cells(L, 1).Resize(N, 3).Value = V L = L + N End If Next Me.ListObjects(1).Range.Columns.AutoFit End Sub
Do you like it ? So thanks to click on bottom left star icon « ★ Add Reputation » !
Bookmarks