Hi.
I have a recorded macro which -
1) Sorts data in ascending order
2) Splits data (Text to Columns)
3) Deletes few columns
4) Remove duplicates as per column B
5) Cut and pastes column A data to column C, and
6) Copies data from Column B and C, and paste them in sheet2 in Range E4
The recorded macro is assigned to button "02nd Run" in the attached sheet.
Below is the code -
Assistance required for -
There are few manual steps that I do before the macro is run. Don't know how to record or write macro for the manual steps.
Manual steps involved -
1) Insert 111111111 in Cell A1 on Sheet1
2) Paste data on Cell A2 on Sheet1
3) Auto fit the pasted data
4) Highlight column A, click Data and click A to Z sort option
5) In the attached sheet after doing above 4 steps, start row will be 45
and end row will be 89
On sheet1 in cell M2 and M3, user will enter start and end row details.I have inserted a
command button "01st Run".The idea is when users click on the command button 01st Run macro should do as below -
Start Row -
If user enters start row as 45 macro should select row 45 and move upwards till row 1 and delete the selected rows.
End Row -
If user enters end row as 89 macro should select row 89 and move 500 rows down and delete the selected rows.
Depending on the start and end row details entered macro should perform above mentioned task.
Note -
If users does not enter data for start or end row macro should give a prompt -
"Please enter data"
I have a recorded macro which -
1) Sorts data in ascending order
2) Splits data (Text to Columns)
3) Deletes few columns
4) Remove duplicates as per column B
5) Cut and pastes column A data to column C, and
6) Copies data from Column B and C, and paste them in sheet2 in Range E4
The recorded macro is assigned to button "02nd Run" in the attached sheet.
Below is the code -
Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(4, 1), Array(7, 1), Array(25, 1), Array(31, 1)), _
TrailingMinusNumbers:=True
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Columns("A:B").Select
Range("B1").Activate
ActiveSheet.Range("$A$1:$B$3000").RemoveDuplicates Columns:=2, Header:=xlNo
Columns("A:A").Select
Selection.Cut Destination:=Columns("C:C")
Range("B1:C3000").Select
Selection.Copy
ActiveSheet.Next.Select
Range("E4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("G4").Select
Application.CutCopyMode = False
End Sub
Assistance required for -
There are few manual steps that I do before the macro is run. Don't know how to record or write macro for the manual steps.
Manual steps involved -
1) Insert 111111111 in Cell A1 on Sheet1
2) Paste data on Cell A2 on Sheet1
3) Auto fit the pasted data
4) Highlight column A, click Data and click A to Z sort option
5) In the attached sheet after doing above 4 steps, start row will be 45
and end row will be 89
On sheet1 in cell M2 and M3, user will enter start and end row details.I have inserted a
command button "01st Run".The idea is when users click on the command button 01st Run macro should do as below -
Start Row -
If user enters start row as 45 macro should select row 45 and move upwards till row 1 and delete the selected rows.
End Row -
If user enters end row as 89 macro should select row 89 and move 500 rows down and delete the selected rows.
Depending on the start and end row details entered macro should perform above mentioned task.
Note -
If users does not enter data for start or end row macro should give a prompt -
"Please enter data"