Test Case ID_Select Range_AppRun

Qualsurf

New Member
Joined
Sep 1, 2009
Messages
1
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
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,214,520
Messages
6,120,011
Members
448,935
Latest member
ijat

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