VBA to Sort text output based on keywords

sumits

New Member
Joined
Jul 21, 2016
Messages
7
I have my output in text file which contains 500+ Procedure, Select and Where statements. When I copy this data in excel the output goes to Column A, so I could read column A line by line but I need to separate the text in different sheets.

I want to separate all three statements in different sheets (i.e. - all 'Procedures' in Sheet2, 'Select' statements in Sheet3 and 'Where' in Sheet4).

Excerpts of my data:
PROCEDURE[dbo].[GetSettleData] @AttemptId BIGINT
AS
BEGIN


SELECT Gross AS Amount
,CASE WHEN CustomerID = 0 THEN NULL
WHEN CustomerID = 1 THEN -1
WHEN CustomerID = 2 THEN -2
ELSE CustomerID
END AS CustomerID
,CAST(SubT AS TINYINT) AS SubT
FROM Customer.Table
WHERE AttemptId = @AttemptId;
PROCEDURE [dbo].[GetTransactionRevenueBilling]
@storeId BIGINT
,@endDate DATETIME
,@temporaryIDNumber VARCHAR(50)
AS
BEGIN
BEGIN TRY
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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