Trigger Macro By Any User Initiated Sorting Action

Jul 26, 2014

I'm using macros to apply some complex sorting criteria. It is also applying some cell formatting specific to the sort criteria being applied.

At the start of each macro, I'm resetting all cell formatting to remove any formerly applied formatting that is not correct for the new sort criteria. Basic stuff.... works fine.

Now I need to ensure all formatting created by any macro-generated sort gets removed if a user applies a sort using any sort function from the Ribbon. (Reset all formatting prior to any 'manually applied' sort).

I can create the macro to reset the formatting, just not sure how to trigger it upon user action.

Is it possible to trigger a short macro to reset cell formatting when a user applies a sort using the Data>Sort, Data>Sort Ascending, or Data>Sort Descending commands from the Ribbon?

View 9 Replies


ADVERTISEMENT

Call Or Go Back To Macro After User Action Such As Clicking In A Cell

Sep 27, 2012

I am about to write a small macro to do a iteration calculation. I would like though for the user to select me a cell so that the macro uses the value in that cell to start calculations. Now, what I think would be the problem is how do I code a "time" or notice an action such as clicking in a cell to continue with the macro.

Would it be by inserting a pause in the code of a certain time so that gives the user time to click and wait for the code to start? If so, how would much time is enough? Is there another thing that could restart the code such as "noticing a click in a cell" command in VBA?

View 1 Replies View Related

Search Macro Doen't Work When Initiated From Listbox

Jul 4, 2009

I've been working on a database for a Dutch nursing home, but I'm struggling to get it to work. The file provides for a userform that enables users to search for residents and retrieve their appartmentnumber and the adress of their legal representative.

This userform consists of three parts; in the first, the user can type the full or partial name of the resident of interest in a textbox; in the second phase, all matching registrations are presented in a listbox; and in the third phase, a macro searches for the name selected in the listbox and retrieves the corresponding appartmentnumber and adress.

The first two phases of the userform work fine, but in the third phase, the macro fails to find any matches even though it is practically the same as the macro used in phase 1.

View 2 Replies View Related

Ask User To Confirm Delete Action

Jun 18, 2014

I'm trying to prompt user when he tries to delete a value from a cell so he can confirm is action but not the same way to all cells.

Let's say that I have cells A1:F10 with values, and user should be able to change this values but not to delete them (can't be a blank cell) and I want to prompt him that info (something like "Cell can't be blank!").

In other range a want a different thing: let's say cells H1:K20. In this cells user should be able to change cells values and also delete them but I want to ask him for a confirmation (something like "are you sure").

View 7 Replies View Related

Trigger Solver By User Defined Function

Mar 3, 2007

how can I generate a user defined function(UDF) that triggers excel's solver? I have a set of 5 constraints and one objective that is to be maximized. I want to perform a senstivity analysis for my objective changing these 5 constraints. So I want the UDF to take all the 5 constraints and return me the optimized value (obtained from excel's solver) for the objective cell.

View 8 Replies View Related

Adjust Code From Cell Range Trigger To Button Trigger

Jul 1, 2014

I have the code below that is two separate activities and I want to change the second activity from a cell trigger (Set KeyCells = Range("K42:AD42")) to a button trigger. I need to first to remain unchanged.

I'd be ok if this was just one macro that I could assign to a button but because its two and I need to write the second's to clicking a button I'm over my head.

Its occured to me while writing this that because it'll be a range of buttons I'll probably need to make each one an individual code? Is this the case? If so I may have to just keep this as it is.

View 2 Replies View Related

Trigger Macro After 15 Seconds

Feb 22, 2009

I want to trigger a macro that refreshes a pivot table but I only want to trigger the macro after 15 seconds. The reason is that I am pulling the source data from access mdb so I want only to refresh the data once the data is pulled.

View 3 Replies View Related

How To Trigger Macro On A Condition

Jan 25, 2014

Is it possible to trigger a macro on a condition like this?

If date more than 1 week arrange date in sequence order.

View 2 Replies View Related

Drop-down Box Value To Trigger Macro

Jun 21, 2006

A1 is a drop-down list, created from Data> Validation>List, which lists 3 different words (Text1, Text2, Text3). I have recorded 3 macros (Macro1, Macro2, Macro3). Here's what I want to happen:

When Text1 is selected in A1, I want Macro1 to run (same for Text2/Macro2 and Text3/Macro3). I want the user to be able to change this value as many times as they wish and have the corresponding Macro run each time. I've tried creating the appropriate code in Editor using other threads on this forum, but I can't seem to figure it out.

View 8 Replies View Related

Loop Through An Action Within A Macro

Nov 19, 2008

I am trying to loop through an action within a macro and require some assistance.

I have the following

View 2 Replies View Related

Action When Macro Is Aborted

May 30, 2009

I have a spreadsheet that when I am running an specific macro and userforms, this one sheet is visible, when the macro is not running, then, the sheet is hidden.

Now, that happens automatically the way that I set up my macro; however, if the macro is aborted, the sheet doesn't hide.

View 7 Replies View Related

Repeating Action In A Macro

Nov 23, 2007

I have a macro that is working fine. It calculates some values based on a SQL database and then copy the values and paste them into another spreadsheet.

However, I need to repeat the same procedure 1296 times.

Please see below the macro.

Sheets("QUERIES").Select
Range("C1").Select
ActiveCell.FormulaR1C1 = "2"
Range("C5").Select
Selection.QueryTable.REFRESH BackgroundQuery:=False
Range("D5").Select
Selection.QueryTable.REFRESH BackgroundQuery:=False
Range("C5:G5").Select
Selection.Copy
Sheets("AWB RANGE").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

I need to increment the line #3 (ActiveCell.FormulaR1C1 = "2") that should start with 2 and end with 1296.

Also, I need to increment the line #11 (Range("K2").Select) that should start with K2 until K1296.

The other parts of the macro will not change.

Would you be able please to give me a hand on this explaining how to create a counter to start on 2 and stop with 1296 ?

View 9 Replies View Related

Data Sorting: Find The User Name

Jul 31, 2007

I have a excel spread sheet with 2 pages and on the first is where i want the data to populated, sheet1 has 2 columns. The first is blank and the second list a username the first is where i want the data i need entered

on the second sheet is a imported txt file broken down into columns and i am only concerned with the first 2

here is how i want it to work

sheet 1

column 1 column 2
??? username
??? username1

Sheet 2

column 1 column 2
testing username
testing username1
under username2

I want the code to look into sheet 2 in column 2 to find the username but if column 1 does not have the word testing then i do not want it to show
and if the word testing is there I will then want the code to display a "Yes"
In column 1 on sheet 1

View 9 Replies View Related

Trigger A Macro On Workbook Close?

Dec 5, 2008

When I open my workbook it also opens a separate workbook and hides second book.
when I close myworkbook I want to unhide the hidden one and close it without saving.

View 4 Replies View Related

Trigger Macro At The Start Of The Month

Feb 18, 2009

is possible to trigger a macro at the start of every month. I have a fairly simple bit of VBA, but just want it to execute on the 1st of every new month.

View 3 Replies View Related

Trigger Actions For Three Choices In A Macro

Dec 30, 2009

I have a series of macros altering various workbooks and sheets. They're numbered Step1, Step2, etc. In my Step5 I have a series of Case statements in a macro, and I don't know how to get it to do what I want next. I have NOT tried running this code yet, and I'm sure I have something(s) wrong in it.

1) If the selection in DstWbk, sheet "Steps", is "01DSP" through "11DSP" the macro needs to delete specific columns in the SrcWbk, and then move to the next step (6).

2) If the selection in DstWbk, sheet "Steps", is "*DSP" the macro needs to go directly to the next step (6)

3) If the selection in DstWbk, sheet "Steps", is anything else the macro needs to flash a generic "No Data found" message and move on to Step7.

The part of the code that's throwing me begins at 'Select only the specific regional data' and ends at the "Case Else MsgBox"

View 3 Replies View Related

Trigger A Macro On Arrow Keys

Apr 24, 2007

I'm creating a small Excel RPG where the player moves the around a blank worksheet with the walls of a maze appearing as you approach them (think dark corridors, you can see only 1 cell in all directions around you).

The players current location is shown by excel setting the activecell to the players location. Currently I have four buttons labeled Up, Down, Left and Right which the player clicks to move in the desired direction.

The testers were frequently missing the four movement buttons and this would put the activecell outside of the maze next to one of the buttons. They'd have to move it back manually.

I would like for the players to move around using the arrow keys to use the activecell, as you would normally move around a sheet... but before each movement there is a procedure that check IF the player can move in the desired direction or not (cell borders used for walls), and then once they've moved there are more procedures to check for monsters treasure chests etc.

How can I make the arrow keys trigger the macros that the Up, Down, Left and Right buttons currently trigger, and not just move the activecell?

View 9 Replies View Related

Trigger A Macro :: Event On Enter

Jun 28, 2008

Does anyone no a way to trigger a macro by just using the enter key in a difined rage ("A1:A100") Not worksheetchange

View 9 Replies View Related

Trigger Macro With Worksheet Tab Selection

Jan 14, 2004

I have a macro I'd like to run when a worksheet tab is selected. The macro updates content in various cells.

That action is now triggered with a command button (linked to macro), but I'd like it to take place when the user selects that worksheet tab.

View 9 Replies View Related

Macro To Take Action On All Sheets That Come After Specified Sheet?

May 13, 2014

I have an excel Workbook made up of sheets that are named after months ("May 2014", "Jun 2014" etc). I want to pull data from each sheet that comes after a user specified date.

View 3 Replies View Related

Macro To Disallow Delete Action?

Mar 25, 2013

So I have this worksheet full of formulas that I do not want users to accidentally delete. Now, I know I can use the standard "Protect Sheet" option to not trigger any accidental changes but I would like an additional safety check (since management users will have access to unlock the sheet) via a macro to prompt the user with a message box (with Yes / No options) which essentially asks the user if they are sure they want to delete a cell if the "Delete" button is chosen? If the answer is No, nothing will happen. But if the answer is Yes, it will delete the contents in the cell.

View 1 Replies View Related

Macro To Move Data With Trigger Cell

Feb 21, 2010

I have a single workbook with five spreadsheets. My goal is to move data along a path (or work flow) from one sheet to the next by using a "trigger" pulldown menu choice.

Sheet1 = Prospects
Sheet2 = New Sale
Sheet3 = Upgrade Sale
Sheet4 = Won
Sheet5 = Lost
Sheets 1, 2, and 3 use the same data layout for column A - K.
Sheets 4 and 5 have the same A - K as above and also have columns L - R in common.
The last column in sheet 1, 2 and 3 is a pulldown menu (New, Upgrade, Won, Lost).

Data rows on each sheet start at row 7.

The goal is to use the pulldown choice to remove the data from the current sheet (ex: Prospect) and add it to the next open row in the required sheet (ex: New or Upgrade). I also need to be able to make a similar move from New/Upgrade to Won or Lost.

View 11 Replies View Related

Trigger Sheet Change Target Macro?

Jun 19, 2013

If for example cell A1 begins empty with no data in it other than a formula and something occurs to change the state of cell A1 to a value which triggers a change in cell B1 (a variable), can I use this to fire a sheet change macro ????

Wish to trigger a macro on sheet change based on every cell in column C, is this even possible ???

Or, is a change in a variable (C1) for example, the same as that of a DIRECT user keyboard input for example ???

Code:

Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range
If Not Application.Intersect(Target, Columns(3)) Is Nothing Then
Application.EnableEvents = False
For Each c In Target

[Code]...

View 7 Replies View Related

Trigger Before Close Macro Only If Changes Have Been Made Since Last Save

Jul 2, 2013

I am using the...

Private Sub Workbook_BeforeClose(Cancel As Boolean)

... to capture when a user is about to close a workbook. I then give them a message: "Are you sure you want to exit? Changes you made since you last saved will be lost."

However, to make it neater, is there a way to only trigger the macro if they have made changes since the last save? In other words, if they have not made any changes since the last save, the message will not be displayed, since it is irrelevant.

View 2 Replies View Related

Trigger Macro When Cells Changed By VLookup

Dec 6, 2013

Colouring calendar entries based on a date match... VBA to colour a cell on each line based on date match

The code works fine if you change the date in the cell and press enter however my date changes are triggered via a Vlookup which the code doesn't recognise has changed so doesn't trigger the macro.

Is there any way to amend the VBA code shown below so that it triggers the macro when dates are changed in column I via Vlookup?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("I:I")) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Target.EntireRow.Interior.ColorIndex = xlNone

[Code] ......

View 3 Replies View Related

Trigger Macro Once On Data Change In Cell

Mar 8, 2008

I have an application that updates the text string in A1 every x minutes (time may vary). I'm trying to develop a toutine that will trigger a Macro/call a function/subroutine once only on each change of data (and then not trigger again until the next change...and must only trigger on change of data in this specific cell). So the timeline looks like this

start A1 = "Apples", Fire macro once

start + 10mins A1 = "Oranges", Fire Macro Once again

start + 25mins A1 = "Pears", Fire Macro Once again

etc.

Triggering the macro is no problem but constraining to one triggering is proving a problem (for me anyway) and is really holding up my application progress.

View 5 Replies View Related

Excel 2003 :: Macro For Save As Action

Jul 12, 2014

I have some excel files which should be saved in Excel 97-2003 Workbook format . I am trying to write vba code for that i am struggling at starting . problem is i have 6 excel files which should be saved as Excel 97-2003 Workbook format i don't know how i give 6 files path to code .

View 2 Replies View Related

Macro - Making Extensive Action Items Log For Work

Apr 11, 2012

I am trying to make an extensive action items log for work.

On Sheet 1, rows 1-3 are blank. Row 4 contains column headers.

Column A: Item #
Column B: Description
Column C: Drawing #
Column D: Conforming
Column E: Nonconforming
Columns F, G, H don't really matter

What I am wanting is to be able to put an "x" or check mark in either column D or E (conforming or nonconforming). Then I want to run a macro with a push button (I know how to make these) that when pushed scans the spreadsheet row by row until it finds the "x" or check in Column E. I want it to copy every instance of this and send it to an Action Item Page that I have temporarily called Sheet 2. (This way I can go here to see all nonconforming issues). I do not want it to remove the information from Sheet 1.

Then, I want to be able to change the "x" or check on the Action Item Page to Column D (back to conforming) and the macro (push button preferably) copy and send that information back to the original spreadsheet in the SAME row it was.

So, in short I want this to be a fluid way of checking off a punchlist of items.

To complicate things even further, if possible, I would like to have several worksheets send information to the one Action Item List rather than just the one.

View 2 Replies View Related

How To Make A Macro Take Action When Data Meets Certain Criteria

Feb 6, 2010

I am watching 100 stocks when the stock market opens at 9:30 EST. Not all the stocks will come available to buy or sell at 9:30 but will become available at different time intervals, sometimes 10 minutes after the market opens. When a stock opens it is common for it to spike up, then spike down, then go into a "normal" trading pattern, this is called a slingshot pattern.

If I have a predetermined price up or down for 100 stocks, how can I write a macro that will look at the stock prices and if it shoots above or below a certain value it will submit a buy or sell order? (I already know how to submit the buy or sell orders, just need to get an idea of how to get the macro to constantly check the prices and if it meets my criteria to take action.)

Note: I already have a macro running at one minute intervals to collect data. One minute intervals is to long, I need it in second intervals or less to pick up the slingshot pattern. Is this possible?

View 9 Replies View Related

VBA Macro To Select Cells With Certain Value And Perform Action On Adjacent Cell

Mar 10, 2014

Converting old reports to usable excel format. I am having trouble using VBA to set up a looping macro that would search Column A for cells with the text string: "ACTIVITY TOTAL". If cell has that value I would like to perform text to column action on the adjacent cell (R0C1). The macro recording for the test to column settings i need is :

Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, OtherChar _
:=":", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1)), TrailingMinusNumbers:=True

I have attached a sample of what I am currently working with. The actual file has roughly 6000 lines of data, so I would like the macro to go through all lines.

Attached File : LoopingVBA.xlsx‎

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved