pasting of variable cell value into macro

I have written a macro that runs an autofilter which grabs cell info from a 
different worksheet within that workbook (an entered date). It then uses that 
date to autofilter. It works fine the first time, but aparently plugs that 
info permanently into the macro and will not work on subsequent runs.  I need 
a macro that will grab variable info from a certain cell each time and run 
with that new cell value each time.  Any ideas?. (& yes, I am a newbee)  
sorry..
0
Utf
5/14/2010 10:19:01 PM
excel.programming 6508 articles. 2 followers. Follow

2 Replies
1653 Views

Similar Articles

[PageSpeed] 23

Your problem is refreshing the autofilter.  It is best to clear the old 
filter before applying the new filter.  Here is an example:

Sub puralator()
Dim s As String
s = Sheets("Sheet2").Range("A1").Value
Sheets("Sheet1").Activate
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Selection.AutoFilter Field:=1, Criteria1:=s
End Sub
-- 
Gary''s Student - gsnu201003


"ELDANS" wrote:

> I have written a macro that runs an autofilter which grabs cell info from a 
> different worksheet within that workbook (an entered date). It then uses that 
> date to autofilter. It works fine the first time, but aparently plugs that 
> info permanently into the macro and will not work on subsequent runs.  I need 
> a macro that will grab variable info from a certain cell each time and run 
> with that new cell value each time.  Any ideas?. (& yes, I am a newbee)  
> sorry..
0
Utf
5/14/2010 10:31:01 PM
Maybe use ActiveCell.value  instead of Range("A1").value as filter criterion
but hard to say without seeing your code.


Gord Dibben  MS Excel MVP


On Fri, 14 May 2010 15:19:01 -0700, ELDANS
<ELDANS@discussions.microsoft.com> wrote:

>I have written a macro that runs an autofilter which grabs cell info from a 
>different worksheet within that workbook (an entered date). It then uses that 
>date to autofilter. It works fine the first time, but aparently plugs that 
>info permanently into the macro and will not work on subsequent runs.  I need 
>a macro that will grab variable info from a certain cell each time and run 
>with that new cell value each time.  Any ideas?. (& yes, I am a newbee)  
>sorry..

0
Gord
5/14/2010 10:40:10 PM
Reply:

Similar Artilces:

filter form on value from linked table
Is it possible to filter a form (based on table A) on a value in a table B where the tables are linked? Table A ID lastname firstname companyid ... Table B companyid companyname ... I would like to filter the form records (Table A) by using as input the company name (or part of it) from a textbox. Thank you -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200704/1 Sorry for this but I forgot I would like to use like frm.Filter = as I already use it to filter the form based on values from another txtbox on the lastname -- Message poste...

Displaying values vs formulas
I'm having another brain-dead moment and I hope someone can resuscitate! I'm putting formulas in various cells on a worksheet and some of them are displaying the results and some are just showing in the cell as the formula. How can I get them all to display results. I swear that all the cells are formatted the same but the displays are different. What am I doing wrong? Thanks for any help. Gary Vocks The cells displaying the formula itself and not the results are probably formatted as Text. A quick way to find out if this is so, is to select a cell that displays the formula, the...

Passing a variable number of arguments.
I have two functions that accept variable number of arguments. I want to pass the variable number of arguments from one function to the other. How do I do this? See below: I think I am looking for something to put where I have indicated with the ???. Or maybe there is some other notation. void FirstFunction( const char *ccFormat, // IN: format details ... // IN: argument list ) { // do some stuff // pass data to second function SecondFunction(ccFormat, ???); // do some more stuff } void SecondFunction( const char *ccFormat, ...

Accumulating Values in a Pivot table
Hi all. Does anybody of you know, how I can show in a Pivot table accumulated values (example)in each row: Day Amount Accum. Value 1 50 50 3 75 125 8 105 230 .. .. .. .. .. .. and so on. Maybe someone give me a tip. Thanx a lot Regards Kurt Hi Kurt, That is one of the big advantages of using Pivot Tables One place to start would be Debra Dalgleish's Contextures.com/techtip.html http://www.contex...

deleting a row with macro
NOOBIE here... Here's what Ive got. I am trying to create a "Delete Vendor" button I know there is a much better way to do this.. On one sheet is the linked cell of a combobox. I am selecting that cell, copying and switching to the data sheet. There I want to find the copied cell's value, select that complete ro and delete it. (Only the content, not the row itself because I wil have a sort run afterward and it is an array so I want to keep th size.) My problem is that "Rows(ActiveCell.Row).Select" is executing befor the find dialog box has time to appear effecti...

Forms: can a cell itself be clickable?
Hi! I'm trying to create a form for my boss. I'm using the forms toolbar, but what it does is throw in a check box for instance, but if I change the cell in any way, the "picture" of the click box stays where it's at. Any way to change this? In other words, I don't want to the click box to be a picture, I want it to be an integral part of the cell, so I can modify it as needed (ie. place it centrered horizontally or vertically etc. Am I dreaming in colour? Thanks! Carmen I've seen a macro that will insert a checkmark when you select the cell, but I&#...

Pictures in Excel cells
Dear friends I want to create a book with personal descriptions, including pictures. But how can I get a picture in an Excel cell? I thought that =HYPERLINK("file.jpg") would be the thing, but the pictures are not retrieved when I combine the Excel sheet to the final Word file. Please help. -- Jos´┐Ż Do you object if ... Alt > i > p > f and select the picture what you want to import. HTH -- MRT "Jose" <jose@127.0.0.1> wrote in message news:e4nsg59mm09cuqgr2etqtm06jm87idk343@4ax.com... > Dear friends > > I want to create...

How to lock cell
Hi, How to lock a particular cell without locking the whole work sheet Pls help me. -- Moideen Moideen;1599749 Wrote: > Hi, > > How to lock a particular cell without locking the whole work sheet > > Pls help me. Do you mean have one particular cell that cannot be updated/altered but the rest can? Or do you mean have a locked cell but without protecting the work sheet? -- Spencer101 By default all cells on a sheet are locked when the sheet is protected. Select all cells(CTRL + a...........twice in Excel 2003) then go to format>cells>protection and unlo...

Header and cell referencing
My issue is this: I have 6 sheets. The first sheet contains the clients information. I want to take the last name of the client from the first sheet and have it appear in the header of every sheet after it. How do I create a cell reference inside a header? David David Sub Path_All_Sheets() Set wkbktodo = ActiveWorkbook For Each ws In wkbktodo.Worksheets ws.PageSetup.RightHeader = Sheets("Clients").Range("A1").Text Next End Sub Assumes client's name is in A1 Note: you can do the same thing by right-click on first sheet tab and "select all ...

cell content into a note
hey guys, just curious if this can be achieved or how it can be achieved say i have this Column A Row 1 = Short Description Column B Row 1 = Long descriptoin B2:B10 = are all the short descriptions B2:B10 = are all the long descriptions is there a way to just put the comment into the short description cells from the long description cells via a note and then hide the long description column? can anyone advise as to how this can be achieved? cheers Don't multipost. You could add Comments to the column A cells with the text from Column B cells and have Column B hidden. Sub Comment...

Cell Number Format
Hi, when i type for example this any number with more than 15 digits, the first 15 digits appear like i wrote it but the rest of them are changed by zeros. EX: i write this 123456789123456789 and the number that is kept is 123456789123456000 Does anyone experienced this and knows how to resolve it. Thanks, Ricardo As you can verify in XL Help ("Specifications"), XL is limited to 15 decimal digits of precision for numbers. If you're entering, say, a credit card number, which doesn't require any math to be performed on it, you can preformat the cell as Text or prefix ...

macro to make different tabs in a same sheet
i have a column in my spreadsheet where there are different names can u suggest a macro which makes different tabs in that same exce workbook with the names of different ppl in front of names there is data, i want that data to be transferre also along with the respective names in that tab thank u frnd -- Message posted from http://www.ExcelForum.com Try this example The names are in column A of a sheet named Sheet1 Sub test() Dim cell As Range Dim WSNew As Worksheet For Each cell In Sheets("Sheet1").Columns("A").Cells.SpecialCells(xlCellTypeConstants) Set ...

Move to match cells
My spreadsheet looks like this: A B C D E 1 000801025-8 009601025-3 2007 000801025-8 2007 2 000801026-9 009601026-4 2004 000801026-9 2004 3 000801028-1 009601028-6 2006 000801028-1 2006 4 000801036-8 009601036-3 2008 000801036-8 2008 5 000801044-5 009601044-0 2007 000801044-5 2007 6 000801044-5 009601055-0 2004 000801055-5 2004 7 000801055-5 009601064-8 2001 000801064-3 2001 8 000801055-5 009601091-2 2006 000801091-7 2006 9 000801064-3 009601095-6 2002 000801095-1 2002 10 000801091-7 009601097-8 1998 00...

Nonadjacent Cell Text Overflow
Is there a way to merge nonadjacent cells for text overflow. What I' trying to do is have text entered into a row of merged cells(e.g. Row A1:F1) but if the text is more than the cells can contain to overflo into another nonadjacent row of merged cells(Row3 A1:F1). Thanks fo any help with this -- Db171 ----------------------------------------------------------------------- Db1712's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1591 View this thread: http://www.excelforum.com/showthread.php?threadid=27498 ...

Formatting Phone Numbers in a Merged Cells...
If I want to merge a "Company Name", "Phone Number" and a "Fax" number into 1 cell (for use in a drop down box), is there a way to maintain the 10 digit format for the phone/fax numbers? The phone/fax #'s appear as a string of 10 digits when they are merged, and are hard to read. Currently using a formula like this: =A3&" Phone: "&B3&" Fax: "&C3 I am tired of trying to get it to work, and can't seem to find the answer here. Thank you in advance! One way: =A3 & TEXT(B3,""" Phone:...

Two cells divided into next cell
Hope this makes sense. I have F column that totals down to F16. Then I have a total on D16. I need both totals to be divided and show up on G16. Every cell has $ Amts, but the only cells not totaled down the row are E,G and J. So G16 is blank. Is this possible to do and If so how. I don't even know the formula to Divide and I need this to automatically happen every time I Insert the Amts in the cells. Please help In G16: =D16/F16 "Day" <Day@discussions.microsoft.com> wrote in message news:62C49FCC-273A-425B-9EEF-DCF2109A0DD9@microsoft.com... > > ...

Macro to copy cell down
I want to create a macro that will copy the cell above to the active cell. OR the built-in key that will do that tenbob@optonline.net Bob A few seconds with the macro recorder set to "Relative Reference" gave me this. Sub Macro1() ' ' Macro1 Macro ' Macro recorded 11/3/2003 by Gord Dibben ' ' Selection.Copy ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste Application.CutCopyMode = False End Sub Gord Dibben XL2002 On Tue, 04 Nov 2003 04:26:28 GMT, Bob K. <tenbob@optonline.net> wrote: >I want to create a mac...

Copy and paste an account
I am a Money 2004 user. I have to different files in Money 2004. I would like to copy and paste one account (with all the data and details) from one file to the other one. So far the only solution I see is the Export option, but I do have to create a new account when I follow the Export steps. Is there any way to do this without exporting the account? Thank you. Manuel Toubes What you've seen is wht thye've got. "Manuel Toubes" <ManuelToubes@discussions.microsoft.com> wrote in message news:57CDA428-A52D-4843-AF5F-7DD655759396@microsoft.com... > I am a Money ...

get data form cells sequentially
Hi there, I have a spreadsheet i am creating which is giving me some amount o hassle!!! I'm sure it is possible to do this but i just cant figure ou how:- I have one worksheet which has many copies of the same table, eac table is consistantly ontop of the other i.e. first table uses cells A - G10 (a rectangle of cells). The dates i am trying to use are in a pattern of a nine row seperatio i.e. first date is in cell G2, next one is G11, next one G20, and s on. I need to find out how i can make a formula which i could copy whic would grab the date out of these cells in sequence for pl...

Selecting Charts in a Macro
I have a worksheet which contains 7 charts: 1st Chart = Chart 12 2nd Chart = Chart 7 3rd Chart = Chart 11 4th Chart = Chart 13 5th Chart = Chart 24 6th Chart = Chart 16 7th Chart = Chart 26 I have a macro which copies the worksheet it over to a new worksheet within the same workbook, the charts are then labelled: 1st Chart = Chart 9 2nd Chart = Chart 7 3rd Chart = Chart 13 4th Chart = Chart 10 5th Chart = Chart 2 6th Chart = Chart 12 7th Chart = Chart 15 The macro then tries to select each chart and change the source data, what I don't know is how excel will treat the chart numbers for...

Insert string into a Cell ?
Hi, How do I insert string into a cell ? Dim myString As string myString = "abcd" shp.CellsSRC(visSectionProp, visRowProp, visCustPropsValue) = myString 'This will yield with type mismatch error. Thanks. Hello m, You've got a reference to the cell but not the property of the cell object. So if you want to set the cell's formula you need to use that property. Also, as you're adding a string you need to wrap it up in quotes (note two double quotes in a row get evaluated as a single set of quotes). Have a go with the following: shp.CellsSRC(visSectionProp, ...

Dividing a cell in Excel 2000
I am embarrassed to ask, but here goes. About a year ago some of you on this forum explained how I can divide a cell without creating a whole new row. I can't remember how I did it. With a diagonal line? A horizontal line? A vertical line? Doesn't really matter; I just want to enter a number on each side of the divide. Much appreciation, Lois You can always find previous posts in the archives. Just enter your name or email address in the author field at http://groups.google.com/advanced_group_search?q=group:*excel* to see your posts and any replies. You might take ...

How do I assign a set of values to a selection from a drop list?
Hi. I am trying to assign a set of values, in separate fields ,to a each selection from a drop-down list in Excel (using data validation). What I am trying to do is very smilar to, say, to selecting a SKU from a list and having the product description, unit price etc. fill into their corresponding fields automatically. For example, I pick SKU "11111" from a drop-down list to fill the SKU field, then, automatically, "5-inch widget" comes up in the product description field and "$5.00" shows up in the unit price field. Please help. Mike Along with the d...

How to quote cells when "IF" word is involved
On Sheet1, I have a data set (C1:C100) based on the input of cell A1. When A1 has various method choices,say,"method 1","method 2","method 3", each cell in the data set will have a new value accordingly. (=IF(A1="method 1",formula1,IF(A1="method 2",formula2,formula3)) I want to quote those three data sets on Sheet2. A lousy way is I could just duplicate Sheet1, set A1 to different value and quote data sets from different sheets. Is it possible to quote three data sets simultaneously from Sheet1? Thanks, Ming Perhaps use a 2 variable data t...

Xpath with multiple values..
Is is possible to use XPath with multiple values like in SQL Queries (AND Clause).For example: If I have xml: <rows> <row code=1/> <row code=2/> <row code=3/> <row code=5/> <row code=6/> <row code=7/> <row code=100/> </rows> Now I want only to select rows 1,2,3 an 100 XPath("rows/row[@code='1' and @code='2' and @code='3' or @code='100']"). I tryed like this above, but I got nothing. Any examples. Regards. Try using ORs all the way. An AND situation is impossible here...