Excel vba loop?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have the following pivot table;

TagName 18-Feb 19-Feb
PS001_Pump1.Daily_Runtime 4.20 3.90
PS001_Pump1.Daily_Starts 75 76
PS001_Pump2.Daily_Runtime 4.28 4.03
PS001_Pump2.Daily_Starts 74 76

what i would like to have it look like;

TagName 18-Feb 19-Feb
PS001_Pump1.Daily_Runtime 4.20 / 75 3.90 / 76
PS001_Pump2.Daily_Runtime 4.28 / 74 4.03 / 76

any ideas?
 
Sub macro1()
Dim iRow As Integer
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
'change columns and initial iRow to suit
ws.Cells(1, 5) = ws.Cells(1, 1)
ws.Cells(1, 6) = ws.Cells(1, 2)
ws.Cells(1, 7) = ws.Cells(1, 3)
iRow = 2
Do Until ws.Cells(iRow, 1) = ""
ws.Cells(1 + iRow / 2, 5) = ws.Cells(iRow, 1)
ws.Cells(1 + iRow / 2, 6) = ws.Cells(iRow, 2) & "/" & ws.Cells(1 +
iRow, 2)
ws.Cells(1 + iRow / 2, 7) = ws.Cells(iRow, 3) & "/" & ws.Cells(1 +
iRow, 3)
iRow = iRow + 2
Loop
End Sub

Hth,
Merjet
 
In the source data, separate the pump identifier from the type of
information. then put the type of information is as one of your column
fields.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Pivot Table & Dates 1
Microsoft Query? 2
Slope from a range of cells 1
For Loop 9
Count & List Combinations 9
Conditional formating using VBA 2
Transposing Data in rows to columns (complex) 1
store variable 9

Back
Top