Ladies and gents. I find myself in need of help once again. I am needing to either modify an existing macro to merge cells (much to my disgust) due to layout demands from up higher.
I am currently using a slightly changed version of the following macro (this was the original base)
This produces the following (this is the result of the changes in the above macro)
I am wanting to either have the above macro modified, OR in independant macro (which may be more realistic) to merge cells to end up with the below result
These are only samples. The actual data produced is variable and can range from 100 rows to 800 + rows
I hope I have given enough information.
Can anyone please help
Thanks for all who have taken the time to look
I am currently using a slightly changed version of the following macro (this was the original base)
VBA Code:
Sub transfer_information()
Dim b As Variant, x As Long, y As Long, lr As Long
Dim i As Long, j As Long, k As Long, m As Long
With Sheets("INSPECTION")
lr = .Range("B" & Rows.Count).End(3).Row
ReDim b(1 To lr, 1 To 8)
For i = 13 To lr
If .Range("A" & i).Value = "y" Then
x = .Range("A" & i).Cells(1).Row
y = x
If .Range("A" & i).MergeCells Then y = .Range("A" & i).MergeArea.Rows.Count + x - 1
If k = j Then k = k + 1
j = k
For m = x To y
If .Range("B" & m).Value <> "" Then b(j, 1) = .Range("B" & m).Value
b(j, 2) = 0
If .Range("L" & m).Value <> "" Then b(j, 3) = .Range("L" & m).Value
If .Range("H" & m).Value <> "" Then b(j, 4) = .Range("H" & m).Value
If .Range("M" & m).Value <> "" Then b(j, 5) = .Range("M" & m).Value
If .Range("E" & m).Value = "y" Then
b(k, 6) = .Range("F" & m).Value
b(k, 7) = .Range("C" & m).Value
b(k, 8) = .Range("D" & m).Value
k = k + 1
End If
Next m
i = m - 1
End If
Next i
End With
Sheets("REPORT").Rows("2:" & Rows.Count).ClearContents
Sheets("REPORT").Range("A2").Resize(k, 8).Value = b
End Sub
Serial | Class | HRS | Qty Req | |||||
1 | R | WELD. Repair bent R/H top rail rack. | 1150 | 4.5 | 10741 | pin | 2 | |
1 | R | Repair rack holders, replace pins and ropes. | 127128 | rope | 2 | |||
1 | 68509 | Screw | 2 | |||||
1 | 13614 | Washer | 2 | |||||
2 | F | Replace covers | 0.5 | 10861 | L/S Cover | 1 | ||
2 | 10496 | R/S Cover | 1 | |||||
3 | F | Secure loose | 1371, 1372 | 0.5 | ||||
4 | R | Replace missing rivets, adjust latches, replace box bracket in LHS box. | 1142,1143, 1147 | 4 | 1273 | Washer | 8 | |
4 | 13721 | Nut | 4 | |||||
4 | 610 | BOLT | 4 | |||||
4 | 1852 | WASHER | 4 | |||||
4 | 13948 | WASHER | 4 | |||||
5 | Remove/refit for servicing | 11636 | 1.5 | |||||
6 | Replace missing bracket. | 3 | 1557 | support | 1 | |||
6 | 6508 | Screw | 6 | |||||
6 | 104 | Washer | 6 | |||||
7 | R | Replace locking handle bush. | 10783 | 1 | 1073 | Bush | 1 | |
7 | 5008 | rease nipple | 1 | |||||
8 | R | Replace | 114561 | 1.5 | 12291 | 1 | ||
8 | 10479 | Bearing | 1 | |||||
9 | R | Replace position. | 1459 | 1.5 | 1339 | 1 | ||
10 | X | Replace seals. | 10785, 0802 | 6 | 12605 | Seal | 1 | |
10 | X | Remove/refit for servicing | 12446 | Joiners | 3 | |||
10 | 5 | Seal | 1 | |||||
10 | 5295 | Joiner | 1 | |||||
10 | 12436 | Joiners | 2 | |||||
I am wanting to either have the above macro modified, OR in independant macro (which may be more realistic) to merge cells to end up with the below result
Serial | Class | HRS | Qty Req | |||||
1 | R | WELD. Repair bent R/H top rail rack. Repair rack holders, replace pins and ropes. | 1150 | 4.5 | 10741 | pin | 2 | |
127128 | rope | 2 | ||||||
68509 | Screw | 2 | ||||||
13614 | Washer | 2 | ||||||
2 | F | Replace covers | 0.5 | 10861 | L/S Cover | 1 | ||
10496 | R/S Cover | 1 | ||||||
3 | F | Secure loose | 1371, 1372 | 0.5 | ||||
4 | R | Replace missing rivets, adjust latches, replace box bracket in LHS box. | 1142,1143, 1147 | 4 | 1273 | Washer | 8 | |
13721 | Nut | 4 | ||||||
610 | BOLT | 4 | ||||||
1852 | WASHER | 4 | ||||||
13948 | WASHER | 4 | ||||||
5 | Remove/refit for servicing | 11636 | 1.5 | |||||
6 | F | Replace missing bracket. | 3 | 1557 | support | 1 | ||
6508 | Screw | 6 | ||||||
104 | Washer | 6 | ||||||
7 | R | Replace locking handle bush. | 10783 | 1 | 1073 | Bush | 1 | |
508 | rease nipple | 1 | ||||||
8 | R | Replace | 114561 | 1.5 | 12291 | 1 | ||
104729 | Bearing | 1 | ||||||
9 | R | Replace position. | 1459 | 1.5 | 1339 | 1 | ||
10 | X | Replace seals Remove/refit for servicing | 10785, 0802 | 6 | 12605 | Seal | 1 | |
12446 | Joiners | 3 | ||||||
5 | Seal | 1 | ||||||
5295 | Joiner | 1 | ||||||
12436 | Joiners | 2 | ||||||
These are only samples. The actual data produced is variable and can range from 100 rows to 800 + rows
I hope I have given enough information.
Can anyone please help
Thanks for all who have taken the time to look