jackofalltrades2011
New Member
- Joined
- Jun 24, 2011
- Messages
- 4
Hello GANG!
I have 3 modules I am trying to merge into 1...they are:
Sub WriteOffs()
'
' WriteOffs Macro
' maniplute Imported Oracle Data for write-offs
'
'
Columns("J:L").Select
Selection.Delete Shift:=xlToLeft
Columns("J:J").Select
Selection.Cut
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("J:J").Select
Selection.NumberFormat = "0.00_);[Red](0.00)"
Rows("1:1").Select
Selection.AutoFilter
Range("A2").Select
ActiveWindow.FreezePanes = True
End Sub
Sub rec_inv()
'
' rec_inv Macro
' sort by rec and inv
'
Range("A1:L1048576").Select
Range("A2").Activate
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("K:K") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("G:G") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("H5944BB").Sort
.SetRange Range("A1:L1048576")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
*** Then I have to manually move information from column K to column G (can I write a procedrue for that?) ***
lastly,
Sub doc_write()
'
' doc_write Macro
' Sort by doc date and w/o date
'
'
Range("A1:L1048576").Select
Range("G2").Activate
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("F:F") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("K:K") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("H5944BB").Sort
.SetRange Range("A1:L1048576")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
SO...From beginning to end--I need to get data from a text file, delete some of the columns, sort the rec_inv column numbers, move the sorted REC numbers into the blank INV numbers column, then sort by Doc_Write without having to change the activeworkbook.worksheets NAME each time I run the last 2 subs....
I have 3 modules I am trying to merge into 1...they are:
Sub WriteOffs()
'
' WriteOffs Macro
' maniplute Imported Oracle Data for write-offs
'
'
Columns("J:L").Select
Selection.Delete Shift:=xlToLeft
Columns("J:J").Select
Selection.Cut
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Columns("J:J").Select
Selection.NumberFormat = "0.00_);[Red](0.00)"
Rows("1:1").Select
Selection.AutoFilter
Range("A2").Select
ActiveWindow.FreezePanes = True
End Sub
Sub rec_inv()
'
' rec_inv Macro
' sort by rec and inv
'
Range("A1:L1048576").Select
Range("A2").Activate
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("K:K") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("G:G") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("H5944BB").Sort
.SetRange Range("A1:L1048576")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
*** Then I have to manually move information from column K to column G (can I write a procedrue for that?) ***
lastly,
Sub doc_write()
'
' doc_write Macro
' Sort by doc date and w/o date
'
'
Range("A1:L1048576").Select
Range("G2").Activate
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("F:F") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("H5944BB").Sort.SortFields.Add Key:=Range("K:K") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("H5944BB").Sort
.SetRange Range("A1:L1048576")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
SO...From beginning to end--I need to get data from a text file, delete some of the columns, sort the rec_inv column numbers, move the sorted REC numbers into the blank INV numbers column, then sort by Doc_Write without having to change the activeworkbook.worksheets NAME each time I run the last 2 subs....