Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default Macro - select cell value, not permanent value

Per the macro below, how do we select the cell value and not the number value
currently in the cell? That is, we don't want it to select "2871". We want it
to select what is in cell A1. If it happens to be 2871, great. If not, we
want it to display whatever number is there.


Range("C7").Select
Selection.Copy
ActiveSheet.Next.Select
Selection.AutoFilter Field:=1, Criteria1:="2871", Operator:=xlAnd
Range("A1").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default Macro - select cell value, not permanent value

not a hundred percent sure I know what you want but try
ActiveSheet.Next.Select
cri1 = range("A1")

Selection.AutoFilter Field:=1, Criteria1:=cri1, Operator:=xlAnd
Range("A1").Select

"Becky" wrote:

Per the macro below, how do we select the cell value and not the number value
currently in the cell? That is, we don't want it to select "2871". We want it
to select what is in cell A1. If it happens to be 2871, great. If not, we
want it to display whatever number is there.


Range("C7").Select
Selection.Copy
ActiveSheet.Next.Select
Selection.AutoFilter Field:=1, Criteria1:="2871", Operator:=xlAnd
Range("A1").Select
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 73
Default Macro - select cell value, not permanent value

That didn't seem to work. Let me try to rephrase.

We have two sheets. On sheet 1, in cell A1, we have a product # (e.g.,
4328). On sheet 2, starting in cell A1 going down, we have a data set that
includes many different product numbers (including e.g., 4328) along with
other data.

The macro should do this: Using the number in cell A1 on Sheet 1, filter on
cell A1 on Sheet 2 for that number. If we have three product numbers in the
dataset, it should only display the number that was filtered.

Hopefully this makes more sense.

"bj" wrote:

not a hundred percent sure I know what you want but try
ActiveSheet.Next.Select
cri1 = range("A1")

Selection.AutoFilter Field:=1, Criteria1:=cri1, Operator:=xlAnd
Range("A1").Select

"Becky" wrote:

Per the macro below, how do we select the cell value and not the number value
currently in the cell? That is, we don't want it to select "2871". We want it
to select what is in cell A1. If it happens to be 2871, great. If not, we
want it to display whatever number is there.


Range("C7").Select
Selection.Copy
ActiveSheet.Next.Select
Selection.AutoFilter Field:=1, Criteria1:="2871", Operator:=xlAnd
Range("A1").Select
End Sub

  #4   Report Post  
Junior Member
 
Posts: 1
Default

Quote:
Originally Posted by Becky View Post
That didn't seem to work. Let me try to rephrase.

We have two sheets. On sheet 1, in cell A1, we have a product # (e.g.,
4328). On sheet 2, starting in cell A1 going down, we have a data set that
includes many different product numbers (including e.g., 4328) along with
other data.

The macro should do this: Using the number in cell A1 on Sheet 1, filter on
cell A1 on Sheet 2 for that number. If we have three product numbers in the
dataset, it should only display the number that was filtered.

Hopefully this makes more sense.

"bj" wrote:

not a hundred percent sure I know what you want but try
ActiveSheet.Next.Select
cri1 = range("A1")

Selection.AutoFilter Field:=1, Criteria1:=cri1, Operator:=xlAnd
Range("A1").Select

"Becky" wrote:

Per the macro below, how do we select the cell value and not the number value
currently in the cell? That is, we don't want it to select "2871". We want it
to select what is in cell A1. If it happens to be 2871, great. If not, we
want it to display whatever number is there.


Range("C7").Select
Selection.Copy
ActiveSheet.Next.Select
Selection.AutoFilter Field:=1, Criteria1:="2871", Operator:=xlAnd
Range("A1").Select
End Sub
Becky,

I know what u're saying. I was looking for the same thing. Pre-select your cell of interest and then try this:

Dim text1 As String
text1 = ActiveCell.Value2

Sheets("XXX").Select
ActiveSheet.Range("$A$1:$S$1000").AutoFilter Field:=6, Criteria1:=text1


Replace items in bold with whatever suits you.
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
Macro - Select cell with no text Dileep Chandran Excel Worksheet Functions 3 December 6th 06 06:01 AM
select last cell in a dynamic list using a macro uncrox Excel Discussion (Misc queries) 4 July 19th 06 01:27 PM
Run a macro from cell select famdamly Excel Discussion (Misc queries) 3 March 3rd 06 03:51 PM
How can I keep my cell borders permanent? karstens Excel Worksheet Functions 1 October 19th 05 05:18 PM
Macro for cell select comotoman Excel Discussion (Misc queries) 5 October 14th 05 10:06 PM


All times are GMT +1. The time now is 06:47 AM.

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

About Us

"It's about Microsoft Excel"