A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro/VB coding question



 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old June 4th, 2010, 08:32 PM posted to microsoft.public.excel.misc
melExcel2007
external usenet poster
 
Posts: 2
Default Macro/VB coding question

I want a macro to work for a worksheet name which will always be the same
directory and file name but the data inside worksheet will periodically
change - increase in rows/decrease in rows. # of Columns/Column names will
not change. I'm trying to filter for a non-changing set of info, then delete
the results.

Here's what I get if I record my current run:

Workbooks.Open Filename:= _
"***Directory of location and file name here***"
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$S$746").AutoFilter Field:=5,
Criteria1:=Array("10" _
, "11", "12", "13"), Operator:=xlFilterValues
Rows("2:28").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$1:$S$719").AutoFilter Field:=5
Rows("1:1").Select
Selection.AutoFilter

I see the ActiveSheet.Ranges will need to change with each incarnation of
the worksheet. So, I could probably set these to A1:S60000 as the
spreadsheet will never get beyond that many rows. But, selecting the results
of filter - rows to delete portion is problematic. Any suggestions? Or
should I filter and set the Operator to delete? If so, what would that look
like?
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:29 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.