Hi All,
I have to format a report on daily basis. For that I had recorded a macro and it works quiet good. But when i have less data or more data it wasn't working.
My activities are as follows:-
1. Select the entire sheet.
2. Go to sort > sort by "Column A"
3. "Sort Warning" dialog box displays. On which i need to select "Sort numbers and numbers stored as text separately" And clicked on "OK".
4. Then select "A1".
5. Ctrl + F (Find and Replace) and search for "CALLID".
6. One press "Down Arrow" and press "Shift + Tab" and then "Ctrl + Shift + Down Arrow"
untill the end of the sheet.
7. Then press "Ctrl + -"
8. Again search for "CALLID"
9. And select the entire row by pressing "Shift + Tab"
10. Cut the row and paste it as "Header of the file".
My recorded macro code is
[pre]
[/pre]
Kindly advise me.
Thank you,
Vargeesh
I have to format a report on daily basis. For that I had recorded a macro and it works quiet good. But when i have less data or more data it wasn't working.
My activities are as follows:-
1. Select the entire sheet.
2. Go to sort > sort by "Column A"
3. "Sort Warning" dialog box displays. On which i need to select "Sort numbers and numbers stored as text separately" And clicked on "OK".
4. Then select "A1".
5. Ctrl + F (Find and Replace) and search for "CALLID".
6. One press "Down Arrow" and press "Shift + Tab" and then "Ctrl + Shift + Down Arrow"
untill the end of the sheet.
7. Then press "Ctrl + -"
8. Again search for "CALLID"
9. And select the entire row by pressing "Shift + Tab"
10. Cut the row and paste it as "Header of the file".
My recorded macro code is
[pre]
Code:
Sub Formatting()
'
' Formatting Macro
'
' Keyboard Shortcut: Ctrl+q
'
Cells.Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A1:A3411" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:Z3411")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A1").Select
Cells.Find(What:="CALLID", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
Rows("3023:3023").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Rows("3022:3022").Select
Selection.Cut
Selection.End(xlUp).Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown
Range("A1").Select
End Sub
Kindly advise me.
Thank you,
Vargeesh