Macro Help for Autofilter

nirav.gangar

New Member
Joined
Jul 22, 2011
Messages
1
hi

New to the world of excel macro. Problem which i face is a have a static header in row "A". Every day i get information which i add in my excel sheet.

Example:

Deal Ref Inst Id Trade Date Underlying
111 1234 11/1/2011 NASDAQ
222 2468 11/2/2011 NYSC
333 1235 11/3/2011 DOW
444 2470 11/4/2011 NYSC
555 1236 11/5/2011 NASDAQ
666 2472 11/6/2011 DOW
777 1237 11/7/2011 NASDAQ
888 2474 11/8/2011 NYSC
999 1238 11/9/2011 NYSC
1110 2476 11/10/2011 NYSC
1221 1239 11/11/2011 NIFTY
1332 2478 11/12/2011 NASDAQ
111 1234 11/1/2011 NASDAQ
222 2468 11/2/2011 NYSC
333 1235 11/3/2011 DOW
444 2470 11/4/2011 NYSC
555 1236 11/5/2011 NASDAQ
666 2472 11/6/2011 DOW
777 1237 11/7/2011 NASDAQ
888 2474 11/8/2011 NYSC
999 1238 11/9/2011 NYSC
1110 2476 11/10/2011 NYSC
1221 1239 11/11/2011 NIFTY
1332 2478 11/12/2011 NASDAQ

I need to change every day the short name.
Let take example of "NYSE" to "New York Stock Exchange"
When every i record a macro the following result happens

Range("A1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$25").AutoFilter Field:=4, Criteria1:="NYSC"
Range("D3").Select
ActiveCell.FormulaR1C1 = "New York Stock Exchange"
Range("D3").Select
Selection.FillDown


Problem
it defines D3 every time i run the macro and change the value to New York Stock Exchange.

i want a macro where in it will be dynamic and select next row and not specific cell after i apply filter.


i know am bad in explaning but still have tried.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi there, Try ~ (Always save your workbook first!)

In the formulas menu, click Define name, in the name box type Nyse, in the refers to box type or copy and paste this ~
=OFFSET(Sheet1!$D$1,1,0,COUNTA(OFFSET(Sheet1!$A$1,1,0,9999)),1)
click ok. Then this code.

Code:
Sub nyse()
Range("A1:D1").Select
Selection.AutoFilter Field:=4, Criteria1:="NYSE"
Range("Nyse").Select
Selection.SpecialCells(xlCellTypeVisible) = "New York Stock Exchange"
Selection.AutoFilter
End Sub

You must have at least one NYSE to filter, if you do not it will put New York Stock Exchange in all cells.
cheers
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,812
Members
452,945
Latest member
Bib195

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top