Can someone help please?
Have thousands of Test Cases in groups of 3 to 50 with a complex ID in a format something like:
QC/Type/Test Group/TestCaseID(A)/001
QC/Type/Test Group/TestCaseID(A)/002
QC/Type/Test Group/TestCaseID(A)/003
QC/Type/Test Group/TestCaseID(B)/001
QC/Type/Test Group/TestCaseID(B)/002
QC/Type/Test Group/TestCaseID(B)/003
Sometimes they skip and start a new Test Case on /002 instead of 001
QC/Type/Test Group/TestCaseID(C)/003
Etc...
Most of the IDs are in column A
Most of the Expected Results are in column F
I want a macro to read the Test Cases ID in Column A 001-00X
Select the corresponding range in column F
Then trigger the following macro and continue to next group of Test Cases
(The macro concatenates the selection into the first row ie Test Case 001 and deletes empty rows.)
Works great but tired of hand selection thousands of groups of Test Cases.
Please Help.
Sub CombineDelete_final()
Dim j As Integer
Dim i As Integer
Dim k As Integer
Dim d As Long
' Concatenates & numbers values in selected cells into the first cell by jt.
' tested and works well
If Selection.Cells.Count > 1 Then
For k = 1 To 1
Selection.Cells(1).Value = "1. " & Selection.Cells(1).Value
Next k
End If
If Selection.Cells.Count > 1 Then
For j = 2 To Selection.Cells.Count
i = j
Selection.Cells(1).Value = Selection.Cells(1).Value & vbLf & i & ". " & Selection.Cells(j).Value
Selection.Cells(j).ClearContents
Next j
End If
'Deletes the entire row within the selection if the ENTIRE row contains no data.
'used Long in case they have over 32,767 rows selected.
'turned off calculation and screenupdating to speed up the macro.
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
'working backwards because we are deleting rows.
For d = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(d)) = 0 Then
Selection.Rows(d).EntireRow.Delete
End If
Next d
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub
Have thousands of Test Cases in groups of 3 to 50 with a complex ID in a format something like:
QC/Type/Test Group/TestCaseID(A)/001
QC/Type/Test Group/TestCaseID(A)/002
QC/Type/Test Group/TestCaseID(A)/003
QC/Type/Test Group/TestCaseID(B)/001
QC/Type/Test Group/TestCaseID(B)/002
QC/Type/Test Group/TestCaseID(B)/003
Sometimes they skip and start a new Test Case on /002 instead of 001
QC/Type/Test Group/TestCaseID(C)/003
Etc...
Most of the IDs are in column A
Most of the Expected Results are in column F
I want a macro to read the Test Cases ID in Column A 001-00X
Select the corresponding range in column F
Then trigger the following macro and continue to next group of Test Cases
(The macro concatenates the selection into the first row ie Test Case 001 and deletes empty rows.)
Works great but tired of hand selection thousands of groups of Test Cases.
Please Help.
Sub CombineDelete_final()
Dim j As Integer
Dim i As Integer
Dim k As Integer
Dim d As Long
' Concatenates & numbers values in selected cells into the first cell by jt.
' tested and works well
If Selection.Cells.Count > 1 Then
For k = 1 To 1
Selection.Cells(1).Value = "1. " & Selection.Cells(1).Value
Next k
End If
If Selection.Cells.Count > 1 Then
For j = 2 To Selection.Cells.Count
i = j
Selection.Cells(1).Value = Selection.Cells(1).Value & vbLf & i & ". " & Selection.Cells(j).Value
Selection.Cells(j).ClearContents
Next j
End If
'Deletes the entire row within the selection if the ENTIRE row contains no data.
'used Long in case they have over 32,767 rows selected.
'turned off calculation and screenupdating to speed up the macro.
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
'working backwards because we are deleting rows.
For d = Selection.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Selection.Rows(d)) = 0 Then
Selection.Rows(d).EntireRow.Delete
End If
Next d
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub