Iamsuyog

New Member
Joined
May 22, 2017
Messages
32
PatientT1T2T3V4T5T6T7T8V1
15
16
17
21011151617
314
315
411
518
519

<tbody>
</tbody>

i want all result in perpenducular

Patienttestresult
1T15
1T26
1T37
2T210
2T311
2V415
2T516
2T617
3T214
3V415
4T111
5T518
5V119

<tbody>
</tbody>

so on

kindly help me to solve this issue?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Code:
Public Sub ECG()

Dim sourceSheet As Worksheet
Dim targetSheet As Worksheet
Dim lastRow As Long
Dim lastCol As Long
Dim thisRow As Long
Dim thisCol As Long
Dim nextRow As Long

' Set the source sheet and find the last row and column
Set sourceSheet = ActiveSheet
With sourceSheet
    lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
    lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With

' Create a new target sheet and add the headers
Set targetSheet = Worksheets.Add
With targetSheet
    .Cells(1, 1).Value = "Patient"
    .Cells(1, 2).Value = "Test"
    .Cells(1, 3).Value = "Result"
End With
nextRow = 2

' Process the grid
For thisRow = 2 To lastRow
    For thisCol = 2 To lastCol
        If sourceSheet.Cells(thisRow, thisCol).Value <> "" Then
            targetSheet.Cells(nextRow, 1).Value = sourceSheet.Cells(thisRow, 1).Value
            targetSheet.Cells(nextRow, 2).Value = sourceSheet.Cells(1, thisCol).Value
            targetSheet.Cells(nextRow, 3).Value = sourceSheet.Cells(thisRow, thisCol).Value
            nextRow = nextRow + 1
        End If
    Next thisCol
Next thisRow

End Sub

WBD
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,175
Members
449,071
Latest member
cdnMech

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