Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 148
Default Macro chaning

I currently use the following macro:
Selection.AutoFilter Field:=1, Criteria1:="<"

How can I change thus macro so that the "1"in field would be changed to the
cell that is selected.
(IE how do I capture the cell where the cursor is located when I run this
macro
In visual basic the code would be something like:
d$=celladdress
Field=d$
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 102
Default Macro chaning


pcor wrote:
I currently use the following macro:
Selection.AutoFilter Field:=1, Criteria1:="<"

How can I change thus macro so that the "1"in field would be changed to the
cell that is selected.
(IE how do I capture the cell where the cursor is located when I run this
macro
In visual basic the code would be something like:
d$=celladdress
Field=d$
Thanks


Try:
Selection.AutoFilter Field:=Application.ActiveCell,Criteria1:="<"

  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default Macro chaning

How about something like:

Option Explicit
Sub testme()

Dim myCol As Long

With ActiveSheet
If Intersect(.AutoFilter.Range, ActiveCell) Is Nothing Then
Beep
Exit Sub
End If
myCol = ActiveCell.Column - .AutoFilter.Range.Column + 1
.AutoFilter.Range.AutoFilter Field:=myCol, Criteria1:="<"
End With

End Sub



pcor wrote:

I currently use the following macro:
Selection.AutoFilter Field:=1, Criteria1:="<"

How can I change thus macro so that the "1"in field would be changed to the
cell that is selected.
(IE how do I capture the cell where the cursor is located when I run this
macro
In visual basic the code would be something like:
d$=celladdress
Field=d$
Thanks


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Macro chaning

pcor

Selection.AutoFilter Field:=ActiveCell.Column, Criteria1:="<"


Gord Dibben MS Excel MVP

On Wed, 20 Sep 2006 14:34:02 -0700, pcor wrote:

I currently use the following macro:
Selection.AutoFilter Field:=1, Criteria1:="<"

How can I change thus macro so that the "1"in field would be changed to the
cell that is selected.
(IE how do I capture the cell where the cursor is located when I run this
macro
In visual basic the code would be something like:
d$=celladdress
Field=d$
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 148
Default Macro chaning

My thanks to Mark, Dave and Gord for your efforts.
Much appreciated.

"pcor" wrote:

I currently use the following macro:
Selection.AutoFilter Field:=1, Criteria1:="<"

How can I change thus macro so that the "1"in field would be changed to the
cell that is selected.
(IE how do I capture the cell where the cursor is located when I run this
macro
In visual basic the code would be something like:
d$=celladdress
Field=d$
Thanks



Reply
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
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM


All times are GMT +1. The time now is 06:29 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"