Filter Ascending only on the active cell.

Hello Guys,
I was working on a macro to 
Step:-
1) Unprotect Worksheet
2) Autofilter the range and then filter ascending on the active cell.
3) Protect the worksheet again
here is the code :-
Sub Filter_ActiveCell()
    Dim Acell As String
    Acell = ActiveCell
        ActiveSheet.Unprotect Password:="bismillah1111"
        Rows("3:3").Select
        Selection.AutoFilter
' Here is where the problem lies.                
    ActiveWorkbook.Worksheets("Summary Sheet ").AutoFilter.Sort.SortFields.Add Key _
        :=Range(Acell), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveWorkbook.Worksheets("Summary Sheet ").AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Selection.AutoFilter
    ActiveSheet.Protect Password:="bismillah1111"
End Sub
I am trying hard to understand but the variable doesn't work. this took 2 hours of mine but all in vain.
Can someone please help me in this.
Thanks,
Wasimali Bori

The line
Acell = ActiveCell
will set the variable Acell to the value of the active cell. One way to do what you want would be to set Acell to the
address of the active cell:
Acell = ActiveCell.Address
Another way would be
Sub Filter_ActiveCell()
    Dim Acell As Range
    Set Acell = ActiveCell
    ActiveSheet.Unprotect Password:="bismillah1111"
    Rows("3:3").Select
    Selection.AutoFilter
    ' Here is where the problem lies.
    ActiveSheet.AutoFilter.Sort.SortFields.Add Key _
        :=Acell, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    With ActiveSheet.AutoFilter.Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Selection.AutoFilter
    ActiveSheet.Protect Password:="bismillah1111"
End Sub
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • Is tabbing through all the active cells of a table possible?

    hi...
    i need to tab through the active cells which are already not seen on the table. i mean i can only tab through the cells which i see, i need to use the horizontal scrollbar to move to the cells which are not already seen.
    can i programmatically change this behaviour?
    i used the example program below to disable a part of the table.
    http://zone.ni.com/devzone/cda/epd/p/id/2163
    then i noticed this behaviour. hope its the same with arrays also.
    please reply with your valuable suggestions
    thanks in advance
    Renn 
    Kudos always welcome for helpful posts

    Please hav a look at the VI
    Kudos always welcome for helpful posts
    Attachments:
    disabletablecells_test.vi ‏74 KB

  • Question(s​) about the Active Cell:Posit​ion property node for a table control

    Hello,
       What determines the Active Cell Position property node for a table control? I have this in my code and I am displaying its value to a front panel indicator. The value displayed is always set to 0,0. The help for the property node say that it is "read -only" so what sets the value of Active Cell Position  for a Table Control?
    Regards,
    Kaspar
    Solved!
    Go to Solution.

    You set the active cell with a property node.  Once you select an active cell, you can do specific things to that cell and that cell alone, things like set the background color.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Get the active cell in a table on a mouse click, so I can change its color

    Hi guys,
    I am looking at a small application.
    I  have a table. When a user clicks on a particular cell, I need the cell coordinates so that I can change its attributes (e.g. color change) by clicking a button.
    Edit position property of the table gives me the current cell coordinates, but when I click on a button, the previously clicked cell position is lost. How can I fix this problem?
    Is there a way to solve this problem?
    Thanks
    Ravi
    Solved!
    Go to Solution.

    rpula wrote:
    Thanks for the reply. But, Iam trying to avoid using event structures for someother reason in my code. Is there a way, this could be done without event structures.
    Please look at the code attached. Whenever the value in the table goes beyond 100, i want to click on the corresponding cell and then suspend it by using the suspend button, in which case the backgroud color should change to red.
    Thanks
    Saverio's suggestion to use an event structure is a good one so rather than exploring less efficient methods, could you please explain why you are avoiding teh use of an event structure? This will help us help you.
    Just trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can i only allow the activation of the JDialog on top?

    Hi to all,
    i have a problem with a mask swing
    Well, my problem is this:
    In a window, when i click on save button, it's open a customizing JDialog. But i would like how i can deny a click out of this JDialog, that is on top.
    In other words, in this situation, with a jdialog on top, if the user click once again on the save button or out of this jdialog, the jdialog must stay on top and active.
    How i can this?
    Please help me!!
    the code that realize my class is this:
    public class ConsegnaOrdineDialog extends JDialog implements ActionListener {
         private JOptionPane optionPane;
         private String dataOrdine;
         private JButton si, no;
         private JTextField dataConsegna;
         public ConsegnaOrdineDialog(String dataOrdine) {
              this.dataOrdine = dataOrdine;
              dataConsegna = new JTextField();
              si = new JButton("Si");
              no = new JButton("No");
              si.addActionListener(this);
              no.addActionListener(this);
              JPanel panel = new JPanel();
                 panel.setLayout(new BorderLayout(5, 10));
                 panel.add(dataConsegna, BorderLayout.NORTH);
                 panel.add(si, BorderLayout.WEST);
                 panel.add(no, BorderLayout.EAST);
              Object[] options = {panel};
              optionPane = new JOptionPane("La data �:",
                    JOptionPane.QUESTION_MESSAGE,
                    JOptionPane.NO_OPTION,
                    null,
                    options,
                    dataConsegna);
              setContentPane(optionPane);
         public void actionPerformed(ActionEvent e) {
              if (e.getSource() == si) {
              if (e.getSource() == no) {
                   super.dispose();               
    }

    in the constructor
    setModal(true);

  • How can I print ONLY the active document?

    Whenever I go to File/Print the darn PSE 9 program sends all of the working files in the bin to the printer. I've searched online for 2 hours now looking for an answer.
    I like to work with having several to many files in the 'bin' and prefer to only print the active file I'm currently working on without having to close the 'working files' before I can print. How can I print ONLY the active document or file in the project bin? Please help, I've upgraded from PSE 3 to PSE 9 and really like the updated features, but this one pain in the neck default is getting the best of me.

    Thanks for your help, that works nicely. It is good to have control of the printer again.

  • Fill down from D1 to active cell in excel ??

    Hi all. I am trying to write a script to take the values from column A and subtract the value of A$1 from the rest of column A. To do this manually I set D1 = A1-A$1 and then fill down in column D to the last used row in column A. Then copy-special paste values from column D to column A. Below is what I have written so far, but the "select (ranges "D1" thru active cell)" selects cells D1 and the active cell ($D$5) not from cell D1 down to the active cell.
    Any ideas for a newbie?
    tell application "Microsoft Excel"
    set formula of cell "D1" to "=A1-A$1"
    select (get end range "A:A" direction toward the bottom)
    set theEnd to (get first row index of active cell)
    select cell 4 of row theEnd
    select (ranges "D1" thru active cell)
    fill down (ranges "D1" thru active cell)
    end tell

    I figured out a way to do what I was after, but I would think there is a more direct way of doing it.
    If anyone has a way to slim down or clean-up this script, please let me know.
    Here is the script I have now.
    tell application "Microsoft Excel"
    set formula of cell "D1" to "=A1-A$1"
    select (get end range "A:A" direction toward the bottom)
    set theEnd to (get first row index of active cell)
    select column 4 of row theEnd
    set lastRow to "D" & theEnd as string
    set range1 to "D1:" & lastRow
    fill down range (range1)
    end tell

  • JTable - active cell not highlited when editable

    Hello,
    I'm using JDK 1.4.2_05, and I'm seeing some behavior that seems a bit strange.
    In my JTables, some cells are editable, and others are not. When the user moves the active cell around (with the arrow keys, or TAB and RETURN) the non-editable cells show up with a nice blue color. If a cell is editable, it doesn't change at all, so the user has no idea where the "cursor" (meaning the active cell) is.
    These cells don't have any special renderer or anything. My JTable has these set:
    setRowSelectionAllowed(false);
    setColumnSelectionAllowed(false);
    setCellSelectionEnabled(true);Thanks for any advice!
    --- Eric

    Okay, yeah, I overrode the default renderer, and had it check whether the cell was selected or not, setting the background color appropriately. Duh. --- Eric

  • Multicolumn list box, "operate value tool" and "active cell"

    If I use the "operate value tool" to select a row
    of the multicolumn list box, that row gets a dark blue background. 
    However, I cannot determine which property will tell me what is that row or let me
    change that row number.  It is not the active cel or "edit position".  
    I want to programatically change the selection just as the "operate value tool" does.  I can change the background color of the cell but the dark blue of the cells selected by the "operate value tool" take precedence and hide my colors.  
    Extremely frustrated and wishing for Java or C++...
    Alan

    Hi Alan,
    Have a look at event structures and invoke nodes (Point to Row Column) and use property nodes. Here is an attachment.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    mclistbox.PNG ‏12 KB

  • I triend to to clear the active login but when turned on my facebook again i was still logged on

    ok so i tried to erase my history and i only checked the active login one but when i when i went to my facebook and hotmail account it was still logged on , i thought that it should log out itself but it didn't ???

    i did everything you said and then i went and did this but when i went to my Facebook i was still logged on isn't the purpose of this to log you out ???

  • I cannot get GPS Only to work on my ipad3 (4g version, but not on an active cell plan, and wifi off).  Is there some new requirement in 7.1 or 7.1.1 to have cell and/or wifi enabled for GPS to work? I am testing with MotionX

    It seems like I cannot get GPS only to work on my ipad3 (4g version, but not on an active cell plan, and wifi off).  Is there some new requirement in 7.1 or 7.1.1 to have cell and/or wifi enabled for GPS to work? I am testing with MotionX, garmin blueChart mobile, and a GPS monitoring tool. All show no signal. If I turn on cell and wifi,  it says I get gps signal, but can't tell if that is from the GPS chip, or just from cell and wifi only (maybe with some gps mixed in)?  Any ideas on how to get iPad working with GPS only??

    Roger that.  Thanks for your time.
    System:
    Windows 7 64bit
    Processor: AMD phenom IIX4 965
    RAM:  Gskill Ripsaw F3-12800CL7D-4GBRM (2-2GB sticks)
    GPU:EVGA Classified Nvidia GeForce GTX 560 Ti 448 core
    PSU: Kingwin 1000W laser gold (LZG-1000)
    Yes. tried the one ram stick, no go.  I have been trying to boot off/install the windows 7 disk but am unable to get to the point where windows starts installing after its gathering information portion of the install.  I can get to the disk selection screen of the install with the WD HD on SATA port 2 but then get the "cant install messages" when I try to select the Vertex 3.  Yes I can see the Vertex 3 Drive as well as the WD drive at this point.  some times I have to hit "scan" a couple of times.

  • IOS5.0.1 constant error "iPhone can not make or receive calls.  Restore from iTunes":  I get this message and the phone will no longer work (happend once while on airplain mode and now once while in wifi only area, out of cell range).  help!

    All- I get this message ("iPhone can not make or receive calls. Restore from iTunes" (happend once while on airplain mode and now once while in wifi only area, out of cell range)). iPhone 4.  Newest OS.  Never happened with old OS! Cycling phone on/off does not help.  Ignoring message causes phone to cycle off then on.  After first time this happened, I restored.  Six days later...same problem!  Clearly a new fix is necessary.  Suggestions? 

    I have not tried that...I will look up the process so that I can do it correctly (and still transfer all of my files, contacts, etc).  Any suggestions?  What is the advantage of restoring as a new device..is this more akin to a complete wipe of a hard drive?

  • "The selected cells are read-only" error on Custom Field when trying to insert in Datasheet mode

    I have a custom field that works completely fine. Yesterday our QA team found out that when trying to insert in Datasheet format, the error "The selected cells are read-only" was thrown. Any ideas? I tried passing the following property to my fldtypes_field.xml file:
        <Field Name="ReadOnly">FALSE</Field>
    No luck.Victor Palma

    Unfortunately it did not work. I also developed the code and access the field and checked its property called "ReadOnlyField"  which is already set to false.
    Below is the xml that i am using. Can you please share the xml that you had used?
    <?xml version="1.0" encoding="utf-8"?>
    <FieldTypes>
      <FieldType>
        <Field Name="TypeName">MyCustomField</Field>
        <Field Name="ParentType">Text</Field>
        <Field Name="TypeDisplayName"> My Custom Field</Field>
        <Field Name="TypeShortDescription"> My Custom Field</Field>
        <Field Name="AllowBaseTypeRendering">True</Field>
        <Field Name="ReadOnlyField">False</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="ShowInListCreate">TRUE</Field>
        <Field Name="ShowInSurveyCreate">TRUE</Field>
        <Field Name="ShowInDocumentLibraryCreate">TRUE</Field>
        <Field Name="ShowInColumnTemplateCreate">TRUE</Field>
        <Field Name="FieldTypeClass">My Assembly Information goes here</Field>
      </FieldType>
    </FieldTypes>

  • Found an locked iphone5c, how can i get the owners info, email or anything if he/she only says "pls. bring back my phone.. godbless" on the activation menu??

    found an locked iphone5c, how can i get the owners info, email or anything if he/she only says "pls. bring back my phone.. godbless" on the activation menu??

    Try using Siri and ask "Who's phone is this?" It should give you the name, number, and email address of the owner. Also, you can try swiping to unlock, select Emergency, then see if they have a Medical ID set up. If they do, they may have the name of a contact with a phone number listed.

  • Excel allows array arithmetic (e.g. sum(a1:a5* b1:b5) where the contents of the cells are the results of formulae.  Numbers only allows constants in the array cells. Right?  Any work-arounds?

    Excel allows array arithmetic (e.g. sum{(a1:a5* b1:b5)} where the contents of the cells are the results of formulae.  Numbers only allows constants in the array cells. Right?  Any work-arounds?

    CJPerry wrote:
    Any work-arounds?
    There is a very simple one : use libreOffice.
    Yvan KOENIG (VALLAURIS, France) dimanche 1 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : http://public.me.com/koenigyvan
    Please : Search for questions similar to your own before submitting them to the community
    For iWork's applications dedicated to iOS, go to :
    https://discussions.apple.com/community/app_store/iwork_for_ios

Maybe you are looking for

  • Siri is not working properly

    I have just updated my new ipad to ios6 yesterday, siri is not working properly how can i fix this problem?

  • Oracle 9.2.0.6 and kernel 7.0 ?

    Can Oracle 9.2.0.6 run with kernel 7.0? Or does only Oracle 10g run with kernel 7.0? Can I upgrade the kernel from 640 to 7.0, then later upgrade Oracel from 9.2.0.6 to 10g?

  • Illegal Region Number

    After months of trouble free running, I'm getting "Illegal Region Number" error messages popping up with no clue as to which region or any other information. Usually (but not always) it happens when I've hit stop after recording an audio track. It do

  • IPad 3 totally no sound.

    iPad 3 totally no sound and shows "sound effect" when adjusting volume. Tried restore many times but still can't solved. Also checked under setting that the change with button to "off". When change with button to "off" I try to adjust the volume, I c

  • Unable to replicate activities from Groupware to CRM

    Hello All, Activities are getting replicated from CRM to Groupware. But, it is not replicating from Groupware to CRM. Can anyone please suggest .... Thanks. Regards, Pratima