SaveAs Triggers ComboBox Change Events
Jan 4, 2009
I have a workbook with several worksheets. One sheet ('Forecast') contains 12 ComboBoxes, which, on a Change event, run a series of macros to show the users certain information and provide certain options: protected 'Budget' or 'Actual' data from a hidden datasheet, or unprotected 'Forecast' cells that respond to user changes. In other words, I can't simply use a series of 'If' statements or VLookups with conditional formatting to get around the ComboBoxes.
OK - So in ordinary use, the ComboBoxes and macros are working as intended.
But there is one situation that causes problems:
When a SaveAs command is used to save the model under a different name, all 12 ComboBox Change Events are somehow being triggered.
So what is it about a SaveAs command that triggers ComboBox Change events?!
And whatever it is, can I turn it off?
(This happens in Excel versions 2000, 2003 and 2007.)
View 9 Replies
ADVERTISEMENT
Dec 13, 2012
I am aware that I can use single changing events in worksheet change events. For instance, if column 1, or A is changed, do something. This is only a single If statement, i.e. either the condition is true, or not. What I am not sure is if I can use two changing events, i.e. two conditions. For e.g. I would like if Column A value is X and Column B is "Active", action it, but only if two conditions are true.
For.e,g. The below syntax does not work. If it is only column A, it does work, but I want both A and B to be true, then copy and paste the target does not anything.
VB:
If Target.Column = 1 Then
If Target.Column = 2 Then
If Not Intersect(Target, Range("A2:A" & Rows.Count)) Is Nothing Then
If Not Intersect(Target, Range("B2:B" & Rows.Count)) Is Nothing Then
If Target.Value = "X" And Target.Value = "Active" Then
View 4 Replies
View Related
Nov 22, 2009
I have a macro that I would like to run everytime ANY cell is changed in a given worksheet. I've read some posts that explain how to do this when say ONE cell is changed, but I cannot figure out how to expand on that.
View 9 Replies
View Related
Apr 26, 2007
Trying to create a dropdown list to navigate to another worksheet . I tried iterations of the following code but am getting an 'object required' error.
If I can't assign the result to a string, how can I change the worksheet from the result of the dropdown list?
Sub DropDown7_Change()
Dim temp As String
temp = ActiveDocument.FormFields(“DropDown7”).Result
Sheets(temp).Select
End Sub
View 9 Replies
View Related
Jun 9, 2005
I would like to add an audio alert to a spreadsheet cell whenever it changes to a specific value?
View 4 Replies
View Related
Dec 14, 2011
I have a Change Event macro that works properly. I also have several cells that contain a drop down list. If a user tries to enter an incorrect entry...the debug is triggered on my even change macro.
Here's the piece of the Change macro that has issues. Specifically, the .undo line highlights.
With Application
.ScreenUpdating = False
.EnableEvents = False
Set SelectedCell = ActiveCell
myTitle = Cells(Range("Titles").Row, Target.Column).Value
myRow = Target.Row
.Undo: myBefore = Target.Value
.Undo: myAfter = Target.Value
SelectedCell.Select
View 3 Replies
View Related
Jul 8, 2013
In both instances I want to put a date stamp of the column immediately after the defined columns below.
The first issue is that when it runs the 1st change event, it only puts the date stamp in the top row of the column. The change in the "Inportedshapeall" column would almost always be brought about from range being copied from another column, however, I would still like a date stamp in every cell of the column.
The second issue comes about when I try to run the second change event. It simply seems to get stuck. I have tried Else, Else if, removing End ifs. I am not sure how best to define the events in order to ensure it loops through both.
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("IMPORTEDSHAPEALL")) Is Nothing Then
With Target(1, 2)
[Code] ......
View 2 Replies
View Related
May 30, 2006
2 Woksheet Change Events? I have a question similar to one that was posted about 2 worksheet change events which I found out is not possible and so I have to merge the codes together and I don't know how. I'm facing a problem in the advanced filter when I remove the last item to be filtered and takes forever to calculate.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address = "$F$2" Or _
Target.Address = "$F$3" Or _
Target.Address = "$F$4" Or _
Target.Address = "$F$5" Or _
Target.Address = "$F$6" Or _
Target.Address = "$F$7" Or _
Target.Address = "$F$8" Or _
Target.Address = "$F$9" Then
Range("Database").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Range("Criteria"), Unique:=False
Exit Sub
End If
If Target.Column = 3 Then
If Target.Value = "YES" Then........................
View 5 Replies
View Related
Apr 21, 2009
I am trying to have multiple change events work in one worksheet and can not get it to work at all.
The simple setup is, I have a column for each month of the year.
I have several rows of numbers beneath each monthly column.
What I want to do is if I enter a date in say January (my change field), I want it to "ClearContents" out all of the data in the August column.
This works fine currently.
But say the next month I enter a date in February, I want to "ClearContents" in the September column. And so on for each month.
My various attempts at this does not recognize the second change agent, so nothing occurs.
Should I try to "call" each section, or use "Else If", or some other idea?
I've tried attaching the worksheet in case that helps to see what I am attempting.
There are extra "items" on the side and below the table that will be removed if I get this "change event" working. So this worksheet is a rough draft so far.
View 10 Replies
View Related
Jan 23, 2010
I realize that it’s not possible to have on one sheet, multiple Worksheet Change Events, so I tried to come up with an alternative method of handling it, but quickly realized that it’s beyond my capabilities at this time.
I would like to set up a worksheet change event on each of a number of identical sheets. Each Change Event will run exactly the same macro. The exception is the “DeptStr” string value that is relevant to the sheet calling the macro .
Each sheet will be a different department.•If the Target in either range has data added, then data will be added to the cell offset one column to it’s right.
•If the Target in either range has data cleared, then data will be cleared in the cell offset one column to it’s right.
•There can only be one sheet active at a time.
•Only one sheet has data entered at a time.
•The two non-contiguous ranges are of equal length. Ex. (C3:C52) and (E3:E52) and are uniquely named in this case,
but they are not a necessary requirement in order to solve this problem if there is a more practical method.
View 3 Replies
View Related
Feb 12, 2007
If a cell in some parts of the worksheet (SSMa,SSDi,SSWo,SSDo,SSVr,SSZa,SSZo in the code) are selected the input (4 digits) should be converted into time (00:00).
Cells in some other parts (Util,Assis) require 6 digits and should be converted into time (00:00:00).
I had the code working in seperate worksheets but combined (as is shown in code bellow) only part of it works.
Only the input entered into the 4 digit part (SSMa,SSDi,SSWo,SSDo,SSVr,SSZa,SSZo) is converted correctly.
The input in the other parts (Util,Assis) is not converted (so when 800 is entered I do not get 00:08:00 but I get the hour equivalent of 8 days (19200:00:00) and logically the message from the EndMacro "You did not enter a valid time".
The cell formats are correct [u]:mm and [u]:mm:ss.
To me it looks like it does not jump to the 6 digits part when need but I can't figure why.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim TimeStr As String
On Error GoTo EndMacro
If Application.Intersect(Target, Range("SSMa,SSDi,SSWo,SSDo,SSVr,SSZa,SSZo,Util,Assis")) Is Nothing Then
Exit Sub
End If
If Target.Cells.Count > 1 Then..........................
View 9 Replies
View Related
Jan 11, 2008
I have a worksheet that I would like to color a range of cell within a row whenever the value of a certain cell in that row changes. For example, if cell A3 have a value of East that row color will be Blue with white fonts, if value is West the row color will be Green with Black fonts, if value is North the row color will be Red with Yellow fonts. This should apply to any row whenever the value is Column A is changed.
View 9 Replies
View Related
Jan 17, 2008
The codes below allows me to change the color of the cells in Col F & G dependence on the value of Col G. I like to add another condition and that is if Col K the value is cancelled or closed the whole row will be CellColor = 48: FontColor = 2
Sub Risk_Color()
Dim c As Range, myFontCol As Integer, myCol As Integer
For Each c In ActiveSheet.Range("f7:g20000")
myFontCol = xlAutomatic
myCol = xlNone
Select Case c.Value
Case Is = 1, 2, 3
myCol = 34....................................
View 9 Replies
View Related
Jul 1, 2009
I'm trying to come up with some code that will allow a user to mouse click a cell to cut it, then mouse click another cell to paste it, then it toggles back to mouse click a cell to cut it. It would be a 2 step process for the user - select cut then select paste.
View 9 Replies
View Related
Jul 3, 2009
I have a previously working _chnage event that I am now trying to nest a similar event in. Neither event works now. What am I doing wrong?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim refrange
If Target.Address(0, 0) "C55,G107" Then Exit Sub
refrange = [MATCH(C55,lst_AgentType,0)]
With Sheets("NewInput").Range("d63:r63")
If refrange = 1 Then
.NumberFormat = "#,##0"
ElseIf refrange = 2 Then
.NumberFormat = "#,##0.00"
Else
.NumberFormat = "0.00%"
End If
End With
If Target.Address(0, 0) = "G107" Then
refrange = [MATCH(G107,lstCommRev,0)]
With Sheets("NewInput").Range("E107")
If refrange = 1 Then
.NumberFormat = "#,##0.00"
Else
.NumberFormat = "0.00%"
End If
End With
End If
End Sub
View 9 Replies
View Related
Jul 27, 2013
I have set up a selection change routine which works if the cell has previously been used or if you make an entry and then change it again. I have tried to delete the empty cells 1st and then save the document, when opening the document it I enter a value in a previosly unused cell the change function does not appear to be called. There is an auto open routine that runs as well, there is more code in use but it fails at the start point.
VB:
Sub Auto_Open()
'
' Auto_Open Macro
'
'
Application.EnableEvents = True
[Code] ......
View 1 Replies
View Related
Nov 21, 2009
I have had a TREMENDOUS amount of assistance from a true gentleman, Jaslake; aka John. In an attempt to quite monopolizing his time I wanted to throw this at the board. I have a number of sub sheets with exact ranges of (B4,d4:b44, D44) update an individual cell (H6:H86) in the” summary” page. My attachment explains it in detail but currently I will show you the formula that resides in (H6) of "Summary". (H6) = Sheet "1". This formula only covers (B4,D4:B10,D10) for example purposes but I need it to run all the way through (B4,d4:b44, D44) for all 80 sheets.
=('1'!B4) & "-" & ('1'!D4) & " | " & ('1'!B5) & "-" & ('1'!D5) & "|" & ('1'!B6) & " - " & ('1'!D6) & "|" & ('1'!B7) & "-" & ('1'!D7) & " | " & ('1'!B8) & "-" & ('1'!D8) & "|" & ('1'!B9) & " - " & ('1'!D9) & "|" & ('1'!B10) & " - " & ('1'!D10).
Results look like this:
March 01, 2009-Today looks good | March 02, 2009-Today looks bad|March 03, 2009 - Today we had issues in Boston|March 04, 2009-Issues in Dallas | March 05, 2009-Issues In New York|March 06, 2009 - New York is complete|March 07, 2009 - Dallas is Complete
NOW, with this said what I really would like to happen, if it is possible, is to have the "Summary" (H6) only have the last range that has been updated showing. So if currently B4,D4 is showing in (H6) once the user types into B5,D5 then it replaces B4:D4. I would like this action to repeat itself until the user has completed their event. The reason I can not stick with a formula in (H6:H86) is because I have a macro running a copy.paste, then clear.contents once a selection is made in Column 4. The information must remain on the sub-sheets but it can be replaced in “Summary “. “Summary” is only a quick view of the current status while the sub sheets are a log of all the work done. So, the following
View 2 Replies
View Related
Jul 6, 2009
I receive real time data ( Last Trade Price ) of soybean commodity futures through DDE in to excel ( cell A1 ). During market hours A1 will keep updating every milliseconds or seconds.
My cell B1 ( =A1 ) will have same value as A1 and will update at the same time.
What I'm looking for - A macro code so Whenever value in B1 is between 9.5000 and 9.5050, I want run a subroutine ( similar to calling a macro ). Since B1 would change dynamically so everytime B1 comes between range 9.5000 and 9.5050 a subroutine is fired.
I'm planning to CALL following subroutine -
Sub BuyBeanst()
Range("N9").Activate
ActiveCell.Value = "Y"
Range("T10").Activate
ActiveCell.Value = "Y"
Range("T11").Activate
ActiveCell.Value = "Y"
End Sub
View 9 Replies
View Related
Oct 20, 2012
I have a UserForm with a Text Box, I populate that Text Box with a number (say 5) and then the following code runs:
Code:
Private Sub tbOverrideMokWh_Change()
Application.EnableEvents = False: Application.ScreenUpdating = False
With tbOverrideMokWh
[Code]....
After the Sub is run 1 time, it runs again. Why? I've disabled Events?
View 6 Replies
View Related
Aug 13, 2012
I'm coding a userform where there are some comboxes which are popolated by values coming from Sheet2. Up to now I work it out (maybe its not elegant but it works).
Now I would like that when the user selects one combobox the values of the other comboboxes are set accordingly to the grid in Sheet2.
Please download the XLS file at: [URL]....
View 2 Replies
View Related
Jun 12, 2007
In cell A1, I have the month number (eg, 1, 2, 3,). The month number reflects current month and will automatically change with every month. For example, right now it’s 6, next month it will automatically change to 7. Each two columns in Range A10:X20 represents the data from January to December. I want to use a worksheet event to change the background of the current month two columns in the range to yellow color and the two columns in the range will be visible when I activate this sheet.
View 3 Replies
View Related
Jan 27, 2009
Although I can live with having a Sub run when setting the ComboBox Sub to AfterUpdate...I would really prefer it to be set to _Change. Here is the Sub code that runs after the event:
View 4 Replies
View Related
Feb 24, 2009
I need to change the background of an worksheet using a combobox!
Let's say that I have 10 or more picture with different names in folder "C:/picture".
I need to change the background of an worksheet selecting this pictures from a combobox.
I know that I can do this manually using "format/sheet/background", but I need to automate the process (in "C:/picture" folder, sometimes I will have more than 50 picture).
View 13 Replies
View Related
Apr 17, 2009
Dim bfr As Long
bfr = ComboBox1.Value
ComboBox1.Value = bfr: Exit Sub
how come this gives me a "cant change property" error!?
The code is inside my combobox change event...
View 9 Replies
View Related
Mar 11, 2007
I have several comboboxes on a userform that work fine as long as I use a whole number, but if I try to use a number with a decimal, I get a run time error 'invalid property'. what I'm doing wrong or if I have to change a property value in the combobox?
View 9 Replies
View Related
May 8, 2009
In this file, I have a Work Summary worksheet in which I'm extracting some data from the other worksheets to "summarize" all jobs into one nice work summary log On Basis of Average of data from 3 other different sheets A,B,C
The following form works great to if onyl formula calling is applied
=AVERAGE(INDIRECT("'"&$C6&"'!c3:c7"))
C6 = Worksheet name or Worksheet tab name ....
View 8 Replies
View Related
Dec 12, 2012
I am looking for a way to use VBA code to allow a combo box (form control) to change the data in a cell. For example: The combo box could contain Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday. If the user selects Monday in the combo box, than cell A1 will populate the word Monday. In the particular situation that I using this for, an if statement will not work since there are 82 values (options) in the combo box.
View 2 Replies
View Related
Jul 31, 2013
I have a massive list of items, most of the same items have different detail depending on the item itself and/or region its being sold etc. I'm been using combo boxes to change regions giving the full range of items within that region but different prices etc.
The problem i'm having with combo box or even vlookup is I can only search or change details in rows (row number), and not able to figure out how to change details within a set of columns (vertically). I want to be able to select the region via combo box and change the details within a set of columns (top to bottom).
View 9 Replies
View Related
Jun 5, 2008
let's say combobox1 has a list of:
apple (KG)
apple (PKT)
apple (BAG)
orange (KG)
Orange (PKT)
Orange (BAG)
and a command button.
Can I make it in a way that when command button detects (kg) in combox1, the caption of commandButton will change to "KG"? if detect (BAG) combobox1, then commandButton is "Bag"?
View 9 Replies
View Related
Apr 24, 2009
How do I set the font size property and special effect property in this code?
I was trying to answer a question on Experrt Exchange but Rory beat me to it and now I'm feeling frustrated that I can't get my solution to work.
Sub AddCombo()Dim rVals As Range, rCell As Range, lTop, lLef, lHeight, lWidth, lCount As LongSet rVals = ActiveSheet.Cells.SpecialCells(xlCellTypeAllValidation)lCount = 1For Each rCell In rVals If rCell.Validation.Type = 3 Then lTop = rCell.Top lLeft = rCell.Left lHeight = rCell.Rows.Height lWidth = rCell.Columns.Width With ActiveSheet.OLEObjects.Add(classtype:="Forms.ComboBox.1", Left:=lLeft, Top:=lTop, Width:=lWidth, Height:=lHeight) .Name = "NewCombo" & lCount .ListFillRange = rCell.Validation.Formula1 .LinkedCell = rCell.Address(0, 0) '.SpecialEffect = fmSpecialEffectFlat //doesn't work // '.FontSize = 14 //doesn't work // '.Font.Size = 14 // doesn't work // End With lCount = lCount + 1 End IfNext rCellEnd Sub
View 9 Replies
View Related