Requesting All Excel Gurus for your assistance.
Let me start by explaining what I have tried.
I tried recording a macro but its only helpful till few steps. After that I have to do
everything else manually.
For better understanding each step mentioned below will be pasted in different sheet
Refer Attachment - Sort
Currently using Excel 2007
Steps used for recording a macro -
1) Sheet1 - How the data is pasted
2) Sheet2 - How the data looks after it is sorted.
This is done by Selecting Column A, Goto Data, Sort.
In the next window all 3 tabs are already highlighted as Column A, Values, A to Z
click ok
3) Sheet2 - All data from Cell 1 to Cell 63 and data from cell 127 to cell 144 is manually
deleted. Dont know how to record this part as data keeps fluctuating and the cell
number keeps changing.
4) Sheet3 - How the data looks after following step 3.
Few things to note -
a) Data is sorted from smallest to largest numbers
b) Each name starts with a number and is followed by a 6 six digit alpha numeric code
c) In the next step this numbers and codes are separated
5) Sheet4 - How the data looks after the numbers and codes are separated
This is done by selecting column A, Goto Data, Text to Columns
In the next window option Fixed width is selected, click next.
In the next window 2 lines are fixed before and after the 6 digit code and
2 lines before and after the numbers - before the names.
A single space is left before the number. Refer Snapshot - Sort. Click Finish
Note - Column B has numbers and column D has codes
6) Sheet5 - From Sheet4 data in column B and D are only required so data in remaining
columns will be deleted.
Note - Codes will always be pasted first followed by numbers in the adjacent column.
7) Sheet5 - Final step is to remove duplicates. Duplicates will be removed on the basis
codes.
This is done by selecting both the columns. Goto Data, remove duplicates. Since the
codes are in Column A, in the next window we will untick Column B and click ok.
Now, I'm looking for a macro that can do all the above steps with a few additions
What the macro should do -
Data will be pasted in Sheet2 Column A.
In sheet1 in Cell M1 I will insert number as 10. This number will tell the macro to copy
data from Cell 10 in Column A. Macro should look for the keyword "Max" and copy data till cell number before the keyword Max.
Explanation -
Keyword Max is in cell 120. When macro runs, it should copy data from cell 10 to cell 119.
Macro should not copy cell number containing the keyword Max.
This data should be pasted in Column A in Sheet1. After this all the above mentioned steps from 1 to 7 should be performed. After the duplicates are removed the Codes and Numbers should be pasted in Column E and F.
Note -
Data in Sheet1 does not contain the keyword Max. You can insert the keyword in the
gaps in the data.
The data is flexible, currently data starts from 080 and ends at 142. This changes on
daily basis. It can start from 001 to 200 and so on.
Humbly request for everyone's expert assistance.
Let me start by explaining what I have tried.
I tried recording a macro but its only helpful till few steps. After that I have to do
everything else manually.
For better understanding each step mentioned below will be pasted in different sheet
Refer Attachment - Sort
Currently using Excel 2007
Steps used for recording a macro -
1) Sheet1 - How the data is pasted
2) Sheet2 - How the data looks after it is sorted.
This is done by Selecting Column A, Goto Data, Sort.
In the next window all 3 tabs are already highlighted as Column A, Values, A to Z
click ok
3) Sheet2 - All data from Cell 1 to Cell 63 and data from cell 127 to cell 144 is manually
deleted. Dont know how to record this part as data keeps fluctuating and the cell
number keeps changing.
4) Sheet3 - How the data looks after following step 3.
Few things to note -
a) Data is sorted from smallest to largest numbers
b) Each name starts with a number and is followed by a 6 six digit alpha numeric code
c) In the next step this numbers and codes are separated
5) Sheet4 - How the data looks after the numbers and codes are separated
This is done by selecting column A, Goto Data, Text to Columns
In the next window option Fixed width is selected, click next.
In the next window 2 lines are fixed before and after the 6 digit code and
2 lines before and after the numbers - before the names.
A single space is left before the number. Refer Snapshot - Sort. Click Finish
Note - Column B has numbers and column D has codes
6) Sheet5 - From Sheet4 data in column B and D are only required so data in remaining
columns will be deleted.
Note - Codes will always be pasted first followed by numbers in the adjacent column.
7) Sheet5 - Final step is to remove duplicates. Duplicates will be removed on the basis
codes.
This is done by selecting both the columns. Goto Data, remove duplicates. Since the
codes are in Column A, in the next window we will untick Column B and click ok.
Now, I'm looking for a macro that can do all the above steps with a few additions
What the macro should do -
Data will be pasted in Sheet2 Column A.
In sheet1 in Cell M1 I will insert number as 10. This number will tell the macro to copy
data from Cell 10 in Column A. Macro should look for the keyword "Max" and copy data till cell number before the keyword Max.
Explanation -
Keyword Max is in cell 120. When macro runs, it should copy data from cell 10 to cell 119.
Macro should not copy cell number containing the keyword Max.
This data should be pasted in Column A in Sheet1. After this all the above mentioned steps from 1 to 7 should be performed. After the duplicates are removed the Codes and Numbers should be pasted in Column E and F.
Note -
Data in Sheet1 does not contain the keyword Max. You can insert the keyword in the
gaps in the data.
The data is flexible, currently data starts from 080 and ends at 142. This changes on
daily basis. It can start from 001 to 200 and so on.
Humbly request for everyone's expert assistance.