Is it possible to write an event trigger macro to format cells? Let's say I want to add a new information to the row which is after FinalRow. Can I force excel to detect the input and then format that new row as previous rows or something custom?
I have a chart with 2 Y axis. I am attempting to write some code that will update both axis with the same max & min value that is triggered by the combobox selection. The code will update the axis but is not triggered by the combobox selection.
I have already use excel web query, and set every 5 minutes auto update web. And here is question , I want to use vba event to trigger when cell's value changed.
Unfortunately,
Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
This code didn't trigger successfully,I think that web query make cells value changed didn't trigger the event.
I have a user entering text into a textbox on my userform. The textbox is linked to a textbox change event. Unfortunately, the event is triggered as soon as the user enters the first character of their entry. I'm thinking that the textbox change event isn't the most appropriate for this scenario. What would I need to do to trigger the code (of the change event) with hitting ENTER when finished?
If no program (code) is running and Calculation is turned to ON, what expression could be placed into a cell that will change on its own that could necessarily and periodically trigger a change event subroutine. How can I trigger a change event when nothing is changing?
I have a situation where my code simply stops running so i need a change event to assess whether code is running (or not) and to issue a warning to the programmer that the code is, in fact, stalled. The change event subroutine has not only a warning system but a "timetorun" feature that will come back and warn again until the programmer can address the issue.
Unfortunately, I have to deal with this issue in a check and balance fashion because my many attempts to seek solutions to a stalled program (root cause) have failed.
I am working with a large legacy file/program which has a lot of issues. Foremost, and unfortunately this cannot be changed, is that all of the controls were placed directly on the worksheets instead of on Userforms.
I had previously posted code from the legacy file which may have been excessively complicated. So I edited my post to this simple example. Sheet1 has one textbox and one command button. Sheet 2 is blank.
If Sheet2.Activate is commented, everything works fine. If Sheet2.Activate is executed, then Excel crashes....
On my userform I have a frame. Within the frame, there are 6 option buttons. Can I trigger an event when when the user selects a different option button? I was expecting to see a Frame.Change method. But I don't. One solution is to insert code on each of the Option Buttons Change methods.
I am working with a large legacy file/program which has a lot of issues. Foremost, and unfortunately this cannot be changed, is that all of the controls were placed directly on the worksheets instead of on Userforms. The actual code from the legacy file is excessively complicated, so I created this simple example. Sheet1 has one textbox and one command button. Sheet 2 is blank. I want to be able to click the command button or use the Enter key on the command button, to trigger the Click Event. Clicking works fine. When using Enter, if Sheet2.Activate is commented, everything works fine. If Sheet2.Activate is executed, then Excel crashes.
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim bBackwards As Boolean Select Case KeyCode 'Only look for tab, return, down arrow, up arrow Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application. ScreenUpdating = False 'Do we need to go back to previous control bBackwards = CBool(Shift And 1) Or (KeyCode = vbKeyUp) If bBackwards Then TextBox1.Activate Else CommandButton1.Activate Application.ScreenUpdating = True End Select End Sub Private Sub CommandButton1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) Dim bBackwards, bForwards As Boolean Select Case KeyCode Case vbKeyTab, vbKeyReturn, vbKeyDown, vbKeyUp Application.ScreenUpdating = False...................
I am trying to write a worksheet_selectionchange macro in which the change is initiated only when certain cells are changed (B6:B9 and X9). I do not want the change to be initiated when any other cells on the worksheet change. B6:B9 and X9 are drop down boxes and the values within the drop-down boxes is variable.
I am trying to create a trigger event that opens an email when a particular row is altered. This all worked fine, until I tried to take it a step further and insert information from the spreadhseet into the email aswell.
I receive Argument not optional.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 10 Then Call GenerateEmail(Target.Address) End If End Sub
I have a project report, which is user-configurable, allowing the user to customise the data that is displayed based on a number of parameters.
To ensure the report always prints neatly (the number of visible columns and rows varies, depending on the above parameters), so I have a macro that dynamically sets the print area of the worksheet.
At present, I call the macro from the workbook.beforeprint event, which works fine in terms of printing. Ideally however, I would like the macro to be called when CTRL+P is first pressed - i.e. the resulting 'print screen', containing a preview of the print out should reflect what will subsequently be printed, when the 'Print' button is then pressed.
I am not sure if this makes sense (Excel 2010 and 2013 are different from previous versions).
So, I have a worksheet with a bunch of combo boxes. The code for the worksheet is below. The issue I'm having is that anytime I drag and drop a cell anywhere on the page, every single control on the worksheet triggers. VB runs through all the code on the sheet, TWICE(I used the debugger extensively trying to find a solution), and causes dozens of successive re-calculations of the entire workbook, which has a couple of tables. This happens on any cell drag-drop on the worksheet, or when I click the command button on the screen.
I have no clue what is causing this. Even more bizarre, it seems to trigger a custom function which is located in a separate module, and isn't even utilized on the worksheet in question. I guess this is because it makes the whole workbook re-calculate?
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.
I have a range of four courses (all child protection) that should be attended, some are eleanring, some local authority courses and staff should attend at least one but up to all four of them. Although they all fall under the question are they compliant or not (i.e.0 or 1)i do not want to count them all seperately. Is there any way I can look at all eight cells related to these courses and assess the latest date to assess if they are complinat (in date) or non compliant (out of date)?
I have attached the spreadsheet which I hope will clarify things
I am using excel 2010. When I click on cells on one column, something like text box will pop up with information related to that column. How can I get rid of this text box. How to disable this text box which I think it has a link between the text box and cells on that column.
Drop down list containing 5 stages of a typical sales cycle, i.e. client engaged, negotiation, prospect, Short-listed, Win/Close.
These are locate in column B and each cell in column B has a drop down list with these 5 options.
Now, based on which option is selected the corresponding cells in column C and D need to change. This change is defined as follows -
Cells in column C, need to change colour ( i.e. blue, orange or red)
Cells in column D, need to change to a percentage value (i.e. at intervals of 10%, 10%,20%, 30% ...etc to 100%)
Column C (corresponding cell i.e. if B3, implies change to C3 respectively). In this case cell colour needs to change to one of three colours listed above.
i.e. if cell in B2 has client engaged, C2 must show blue, Similarly if B2 has short-listed, C2 must show red.
Column D, Equally, depending on colour in Column C, the percentage must automatically populate.
0-30% = Blue 31-50% = Orange 51-100% = Red
I have used conditional formatting options on a trial and error for testing the above, but not getting much progress. I suspect due to the multiple changes and different simultaneous changes i.e. colour and text, a Macro is most likely needed? (I have limited knowledge of VBA).
In closing there are about 200 rows that need to have this capability. I.e. Contents of column B trigger respective cells in Column C and D.
I have completed an automated time sheet but have realised that there are some days where overtime entries make it go wrong.
There is one column where you enter an overtime shift when the cell has an entry I need all the other calculations to be zero
A1 START TIME B1 END TIME C1 HOURS WORKED ARE CALCULATED using a formula D1 OVERTIME COLUMN ( IF AN ENTRY IS PUT IN HERE MANUALLY I WANT C1 ALWAYS BE 0
I tried various ways with isblank but just get true or false.
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
I am trying to find a efficient solution to convert 3 lists (in the same column layouts) to a calender format. I have different lists that are maintained but want to consolidate them into one calender. So rather than looking at 3 individual lists, someone can view this one master calender with all the events/meetings.
The events from each list would automatically populate one master calender.
What I want to do is have a sub-Function that will check to make sure what is entered into a TextBox is a number, and if it is NOT a number that it changes the color of the TextBox to Yellow.
Currently if the entry is not numeric it just clears the cell and that part is good, but I want the color to flag that the user TRIED to put something there.
I'm doing this as a sub-Function since I need to use this check about 20-25 times.
I have a column of cells with values - 0.2%, 0.32%, 0.22, 0.5 etc. The cells with % symbol are in ' Percentage, 2 decimal' format while the plain numbers are in 'General' format i.e. column contains cells in either of these formats. I need a macro where I can specify the column and it will select the cells with the % format, convert it to 'General' and multiply the result by 100 eg. 0.2% converted to 'General' becomes 0.002. When multiplied by 100, result is 0.2 i.e. is displayed without the % symbol.
How can I format cells to contain Minutes, Seconds and Hundredths of seconds to be used in calculations eg 1.24.99 means 1 minute and 24.99 seconds. Example calculation is: 1.24.99 - 1.24.90 =0.0.09
Is there a way to write a Worksheet_SelectionChange (ByVal Target As Range) event in module after creating a sheet in VBA? I constantly delete a sheet, then repopulate it with a new one that is empty, but I need to add some code that happens if they should change a particular cell. It worked when I ran it on a worksheet without refreshing, but as soon as I cleared and repopulated the sheet, it was gone. Is there a way to preserve this?
Below is code. However, I need this to happen for multiple cells.
The cells that I need to monitor are B10, B12, B14.... through B96 and F, J, N, R columns for the same rows. The input values will be stored in cells AM10, AM12, AM14 .... through 96 for the B column results. Then for F, J, N, R will be AQ, AU, AY and BC respectively.
Additionally, when B10 has an input, and the user input box displays for the number of hours, there is a cancel button available, but it does not work. How can I exit the loop and clear contents of B10 if the "Cancel" button is clicked in the dialogue box.