LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 187
Default help me clean up this code

I have the following macro that needs to be cleaned up a bit (part of
the code was generated using the macro recorder; this is the stuff
that I think needs to be cleaned up.

Following is the code:

Option Explicit

Sub ParseELR()
'Parses the ELR report, filters it, copies the filtered records,
pastes them into a new workbook
'and prompts the user to save the file to a specific location
Dim myFileName As Variant

Range("A3").Select
If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.ShowAllData
End If
Range("T2").Select
ActiveCell.FormulaR1C1 = "=IF(AND(ISNUMBER(MATCH(LEFT(RC[-18],
3),'[ELR expense account identification.xls]Sheet1'!
R2C1:R12C1,0)),ISNUMBER(MATCH(RC[-17],'[Frank''s expense codes--GDCS
and non-GDCS.xls]Sheet1'!R2C1:R39C1,0))),""Extract"","""")"
'Applies the filter criteria to each row; if BOTH conditions
return TRUE, "Extract" is returned in Column T

'THIS IS THE SECTION THAT NEEDS TO BE CLEANED UP
Range("T2:T65000").Select
Selection.FillDown
Selection.End(xlUp).Select
Selection.AutoFilter Field:=20, Criteria1:="Extract"
'Runs autofilter on the value "extract" in Column T
Selection.End(xlToLeft).Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
'END SECTION THAT NEEDS TO BE CLEANED UP

myFileName = Application.GetSaveAsFilename
If myFileName = False Then
Exit Sub
End If
ActiveWorkbook.SaveAs Filename:=myFileName,
FileFormat:=xlWorkbookNormal
End Sub

Thanks,

Dave

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
clean up code a little terilad Excel Discussion (Misc queries) 12 April 12th 10 07:35 PM
Clean up code. Tim Excel Programming 2 October 1st 04 05:37 PM
Help clean up this code... scottnshelly[_32_] Excel Programming 8 June 21st 04 09:30 PM
Clean up code using WITHs Richard[_28_] Excel Programming 2 April 30th 04 02:59 AM
Plase help me clean up my code jasonsweeney[_14_] Excel Programming 1 January 22nd 04 07:47 PM


All times are GMT +1. The time now is 07:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"