w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to detect the difference between a change made by a user and a change made programmatically?
If you just change the value with el.value = x, the change event is not triggered. For example, this won't log anything to the console: var el = document.getElementById('el') el.onchange = function(){ console.log('changed'); }; el.value = 'asasassasa'; So, if you're seeing it's being triggered twice, it's either because: You're manually triggering it with el.onchange(). In this case, just remove the this call. Or: The event handler is bound to the element more than once. You have to locate where that's happening.

Categories : Javascript

Is there any way to get a macro or module to change the copy destination cell from one cell to another cell in the next row with each run?
In order to do that, you can do it a couple of different ways: Method 1 In your macro, you will need code that counts how many sheets exist in the workbook. Then use that number to determine what cell on Sheet1 should be copied to cell B10 on the new sheet. This method has some pitfalls if you have other sheets in your workbook. Method 2 Store the row number of the cell you want to copy in a cell somewhere on Sheet1. Every time your macro runs, retrieve that value to determine which cell to copy to the new sheet, then increment that value, so the next time the macro runs, it will get the next cell. This method is probably the most straight-forward, but you need to make sure that you don't accidentally erase or alter the cell containing your current row number.

Categories : Excel

Change value of dropdown to null if specific change is made to radio button, but not just any change
Use click function and use class as the radio box selector. jQuery(document).ready(function($){ $('.myradiobox').click(function(){ var radioVal = this.val(); if(radioVal == 5 || radioVal == 4) { radioVal == 'NULL'; } $('select[name="item_meta[106]"]').val(radioVal); }) })

Categories : Javascript

Using jquery to preset html tickbox
To toggle checked use .prop() instead of .attr(): $('#x').prop('checked',true); $('#x').prop('checked',false); If you want another button to toggle the checkbox you can use: var $x = $('#x'); // don't query every click - Credit: Roko :) $('.button').click(function(){ $x.prop('checked', !$x.is(':checked')); })

Categories : Javascript

Jquery: Detecting if a tickbox is selected
.checked is not a jquery property but a DOM element property. You have to use .is(':checked') or .prop('checked') $("#x").prop('checked',true); //$("#x").prop('checked',false); if ($("#x").is(':checked')) { alert("Checbox is checked"); } else { alert("Checkbox is not checked"); }

Categories : Jquery

Change variable in one macro with another macro in vba
Although it is probably easier to simply call the dialog to set the workbook protection (i.e., this method will have errors if different sheets require different passwords, I've attempted to trap that sort of error) and use the built-in dialogs, this will do pretty much what you're asking for. As always, remember your passwords. I provide no means of retrieving a lost password. Option Explicit Public badpassword As Boolean Sub changepassword() Dim sh As Worksheet Dim pw1 As String Dim newpw As String Dim newpw2 As String badpassword = True 'enter the current password, twice pw1 = enterpassword("Please enter the password to UNPROTECT the sheets") 'prompt for a new password newpw = enterpassword("Please enter the new password") newpw2 = enterpassw

Categories : Excel

vagrant package creates a copy of the original box with no changes I have made
The reason could be that you used the same box name. As you described, you've done something like this: Created a Vagrantfile: Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = 'base' config.vm.box_url = 'http://the-url-of-box-you-used-as-base.com/precise.box' end vagrant up vagrant ssh => there you've made some changes vagrant package --box [name] --output [new.box] Edit the original Vagrant file (or create a new one) to load your new box: Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = 'base' config.vm.box_url = 'my-new.box' end And here I'm assuming you kept the config.vm.box the same, which means Vagrant didn't use your box, but the original previous box as there's already downloaded box with that name in your ~/.vagrant.d/bo

Categories : Windows

Copy cells with formulas in macro
After inserting a new row 2 (so that it's contents are now on row 3), I would copy row 3 back to row 2 (basically make a duplicate), and then override the values with the data you want to move from sheet 'Enter Trade' range B2:B20, like so: Sub Trade_Button_Click() Dim btn As Button Dim wsEntry As Worksheet Dim wsTrades As Worksheet Set wsEntry = Sheets("Enter Trade") Set wsTrades = Sheets("Trades") Set btn = wsEntry.Buttons(Application.Caller) wsTrades.Rows(2).Insert wsTrades.Rows(3).Copy wsTrades.Rows(2) With Intersect(wsEntry.Range("A2", wsEntry.Cells(Rows.Count, "A").End(xlUp)).EntireRow, wsEntry.Columns(btn.TopLeftCell.Column)) wsTrades.Range("A2").Resize(, .Rows.Count).Value = Application.Transpose(.Value) End With Set wsTrades

Categories : Excel

Copy data from excel to csv using macro
Somewthing like this uses array's and is very efficient (it assumes your data has the same column length from D to P for the columns of interest) Sub csvfile() Dim fs As Object Dim a As Object Dim lngRow As Long Dim X Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("c: emp" & Environ("username") & ".csv", True) X = Range([d4], Cells(Rows.Count, "P").End(xlUp)).Value2 For lngRow = 1 To UBound(X) a.writeline X(lngRow, 1) & "," & X(lngRow, 3) & X(lngRow, 4) & ",,," & X(lngRow, 8) & "," & X(lngRow, 9) & "," & X(lngRow, 11) & ",," & X(lngRow, 13) Next a.Close End Sub

Categories : Excel

Excel VBA macro for a complicated Copy Function
Change the workbook and sheet values to the applicable workbook and sheets Sub usermove() Dim c, Rng1 As Range Dim i As Integer i = 1 'ask for input userselect: ThisWorkbook.Sheets("Sheet1").Activate Set Rng1 = Application.InputBox("Please Select Cells", Type:=8) 'loop For Each c In Rng1.Cells ThisWorkbook.Sheets("Sheet2").Activate Cells(i, 1).Value = c.Value i = i + 1 Next 'Prompt for more input continue = MsgBox("Are there more cells to select?", vbYesNo) If continue = vbYes Then GoTo userselect 'then save ChDir "path" ActiveWorkbook.SaveAs Filename:="pathBook1.txt", FileFormat _ :=xlText, CreateBackup:=False End Sub

Categories : Excel

Macro copy and paste based on date
Make Sure your checkboxes are not crossing to two different rows. Once you have ensured it, then I would do something like this: Assign same Macro to all the Checkboxes. In the macro, I will add the Following Code: Dim shp As Shape Dim rng As Range Dim currentRowNumber As Long Set shp = ActiveSheet.Shapes(Application.Caller) Set rng = shp.BottomRightCell currentRowNumber = rng.Row MsgBox "Currently, you are working on Row no " & currentRowNumber Once you have got the Row number, then you can easily find the values and write the code accordingly. Hope this helps! Thanks, V

Categories : Vba

Excel Macro to copy a specific worksheet to another workbook
Try this - Hope this Helps Sub NewReport() Dim PRICE_REV_TEMPLATE As Workbook Dim PRICE_REV_TEMPLATE_FC As Workbook With Application .ScreenUpdating = False .DisplayAlerts = False .EnableEvents = False End With Set PRICE_REV_TEMPLATE = ActiveWorkbook Set PRICE_REV_TEMPLATE_FC = Application.Workbooks.Add(1) PRICE_REV_TEMPLATE.Sheets(Array(PRICE_REV_TEMPLATE.Sheets(1).Name)).Copy Before:=PRICE_REV_TEMPLATE_FC.Sheets(1) 'selecting all cells and pasting as only values PRICE_REV_TEMPLATE_FC.ActiveSheet.Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False PRICE_REV_TEMPLATE_FC.ActiveSheet.Paste Application.CutCopyMode = False 'Added the Readonlyrecommende

Categories : Vba

Copy Paste macro is inducing 'grouped'-worksheet functionality?
By selecting all the sheets in your array, you are grouping them, and anything you write to a cell in any sheet will be written to all sheets. This is the culprit: Sheets(Array("SUMMARY P.1", "SUMMARY P.2", "Process Control", _ "Electrical", "Environmental1", "Env.2 - Regulatory", "FIRE", _ "Human", "Industrial Hygiene", "Maintenance_Reliability", _ "Pressure_Vacuum", "Rotating & Mechanical", _ "Facility Siting & Security", "Process Safety Documentation", _ "Temperature-Reaction-Flow", "Valve-Piping", "Quality", _ "Product Stewardship", "4B ITEMS")).Select The fact that your issue occurs even if the code you posted hasn't been run makes me think there is something else going on after you've selected all the sheets. Note that selecting and activating are a really bad idea. Decl

Categories : Excel

Excel macro to find duplicates and copy their adjacent cells
sort on column C loop through the rows and check if selectedrow.cells(1,3)=selectedrow.cells(2,3) if they are equal copy value of column C to column D, for both this row and next row. also copy column A to column E for this row and next row. loop until the c column of the selectedrow is empty.

Categories : Excel

Microsoft Access macro to handle copy-paste insertion
The Dirty event only fires once for the form: The Dirty event occurs when the contents of a form or the text portion of a combo box changes. It also occurs when you move from one page to another page in a tab control. You can programmatically set the DefaultValue for each form. It needs to be set specifically to a string, though, so requires additional quotes: Private Sub Form_Open(Cancel As Integer) Me.txtFirstName.DefaultValue = """Dave""" End Sub

Categories : Ms Access

Excel Macro - How to copy ALL data from 12 workbooks onto a blank one / Range Inquiry
Ripster has given one example of missing information from your specification. Santosh recommends a pretty neat tool but my reading of your question is that your knowledge is not up to using a tool yet. I deduce this is a work question and your boss has asked you to write this macro despite your knowledge of VBA being zero. This seems to be a growing problem: you can discover the answer to anything on the net so why bother with training people. Even if you produced a complete specification of your requirement, I doubt anyone will give you a complete solution. If they do provide a complete solution, it will not help with the next requirement. So I am going to break your problem down into the type of questions you can ask the net. Each week you get 12 source workbooks and create a summ

Categories : Excel

Excel macro to copy entire row to a new worksheet based on the value of a 'category' column
Assuming what you have in the "Master" worksheet are 3 columns: Name | Address | Category and this Header will be copied across to Category named sheets. Then PopulateMasterContacts will process the rows in Master and put into worksheet that is named Category. If this named worksheet is not found, it will create one and copy the header, then the contact detail. And sort all the worksheets except the Master. Please note this will not remove duplicates. Private Const sMasterSheet As String = "Master" ' Master Sheet Name Private Const lNameCol As Long = 1 ' Coulmn A Private Const lAddrCol As Long = 2 ' Column B 'Private Const lCateCol As Long = 3 ' Column C Private Const lCateCol As Long = 16 ' Column P Dim oShM As Worksheet ' For Master Worksheet Sub PopulateMasterContacts() Const

Categories : Vba

Compile Error: Object Required - Search Copy Paste Macro Excel VBA
You are using the Set keyword wrong. In your code above you only need to use it to assign Worksheet and Range objects, not for integers and strings. Remove the Set keyword on those lines. Also, you're missing an End If in your For loop.

Categories : Excel

create a macro to copy multiple rows of data from one sheet to another based on a criteria
Sub testIt() Dim i As Long, shtSrc As Worksheet, rngDest As Range Application.ScreenUpdating = False Set shtSrc = Sheets("DataDump") Set rngDest = Sheets("PriceData").Cells(Rows.Count, 2).End(xlUp).Offset(1, 0) For i = 2 To shtSrc.Range("B2").End(xlDown).Row If shtSrc.Range("B" & i).Value = 1 Then shtSrc.Range("C" & i & ":AN" & i).Copy rngDest Set rngDest = rngDest.Offset(1, 0) End If Next i Application.ScreenUpdating = True End Sub

Categories : Vba

Macro to iterate through all rows in all columns of a worksheet and compare a cell to copy the row to a text file
You can use the .Offset() method of Range object and vbTab constant to create tab delimited spaces The .Offset(rows, columns) takes 2 parameters. Number of rows up or down of the current cell. To navigate up you give it a negative value to go down a positive one. Same applies to columns except that you use a negative to move left and a positive to go right. vbTab creates a tab between two objects in the context of "this is " & vbtab & " tab delimited" I have modified your comparison method a bit and added the StrComp() function. It is more reliable and you can specify the comparison parameters. Please see how to compare strings in VBA for more details about the = operator in string comparison. I have changed your Sheet4.Range("K1:K300") as this is a bit misleading and wrong

Categories : Excel

Excel Macro - Copy Range Of Cells in Sheet2 to Sheet 1 below Cell With Specific Text
Activesheet and Activecell are too vague. If you are working with a multisheet program it is good practice to specify which sheet you are working in or use a "With Sheets("Sheet1")" for a multiple of "Sheet1". This may not be a cut and paste but you get my meaning: Sub Sheetspractice() NumRows = Sheets("Sheet1").Range("L2:L" & Rows.Count).End(xlup).Row Sheets("Sheet1").Range("L2").Select For x = 1 To NumRows Sheets("Sheet2").Range("A1:G24").Select Selection.Copy Sheets("Sheet1").Cells.Find(What:="Recess Size", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Sheets("Sheet1").Paste Sheets("Sheet1").Range("A1"

Categories : Excel

How to detect value change that is made dynamically
Try this: $("#total_amt").on("input", function() { alert("Handler for .change() called."); }); this is HTML5 thing though won't work with the modern browsers, for other browsers var lastValue = ''; $("#total_amt").on('change keyup paste', function() { if ($(this).val() != lastValue) { lastValue = $(this).val(); calert("Handler for .change() called."); } });

Categories : Javascript

How to change URL links that were made by WordPress?
I believe what you're looking for can be found in the admin panel. In the admin panel (http://www.your-wordpress-site.com/wp-admin), go to Settings > Permalinks

Categories : PHP

Compile Error: Method 'Range' of object '_Global' failed - Search Copy Paste Macro Excel VBA
Try: numRows = selectedRange.Rows.Count '<<<<<<<< Error numColumns = selectedRange.Columns.Count There may be other errors, I have not tested your full code, but this should fix the immediate error you're experiencing.

Categories : Vba

Buttons that need to change their .innerHTML but they are made in a loop so they end up having the same id
When you are looping through creating each button, create a counter variable, or use the variable from the for loop, and each loop increment it by 1 and append that to the ID. for(var i = 0; i < some_number; i++){ var ID = "myButton"+i; //Other code }

Categories : Javascript

Dataframe does not remember change made by a function
Your syntax is wrong if your purpose is to update data1. You should use updateRow <- function(rIndex) { data1[rIndex, 4] <- 1 return(data1) } data1<-updateRow(4) This should do it. It will update row 4 and column 4 and set the value to 1. If you want to skip the last assignment you can define the function as updateRow <- function(rIndex) { data1[rIndex, 4] <<- 1 } updateRow(4) which will also update row 4 and column 4 to the value 1. This is the same solution as dayne has in his answer.

Categories : R

How to make a contenteditable div reversible after change made with js?
What about adding a keyup event handler that will keep track of the current text after every keyup. You can then trap crtl + z and revert back to the previous content if you detect that crtl + z have been pressed. You could potentially keep revisions in an array to support a series of ctrl + z operations.

Categories : HTML

In a "shared" git repository, how do see what user made what change in a git status?
Short answer: No. Git only knows / is aware of the fact that the files in your working copy have changed; it has no knowledge of the working copy beyond that. Also, that's probably a really bad development model to be using.

Categories : GIT

Rails - Do we need to restart server everytime a change is made?
You should not be using the production mode as a "development" mode. If you are making changes regularly, you should test on development mode and then if no bugs are found, you should push your code to your production environment.

Categories : Ruby On Rails

Change colors in a complex animation made of bitmaps/group
You need to define your matrix array before you instantiate the ColorMatrixFilter object. Also, ColorMatrixFilter expects a one dimensional array. See documentation which recommends a syntax using concat which seems to do the trick. Try updating your code with the following: // Matrix should be a one dimensional array var colorMatrix:Array = new Array(); colorMatrix = colorMatrix.concat([0, 0, 1, 0, 0]), colorMatrix = colorMatrix.concat([0, 1, 0, 0, 0]), colorMatrix = colorMatrix.concat([1, 0, 0, 0, 0]), colorMatrix = colorMatrix.concat([0, 0, 0, 1, 0]); // Matrix needs to be defined before it's added to the ColorMatrixFilter var colorFilter:ColorMatrixFilter = new ColorMatrixFilter(colorMatrix);

Categories : Actionscript

jquery: how to prevent dropdown change after user made selection?
Answer to 1st question, To disable, you will have to keep flags. You may keep check which all selects have been changed. Example, var changed1 = false, changed2 = false, changed3 = false, changed4 = false; Then on changing any, say 1st, $("#001").change(function(){ changed1 = true; if(changed2 && changed3 && changed4){ $("#001").prop('disabled', true); } }); $("#002").change(function(){ changed2 = true; }); $("#003").change(function(){ changed3 = true; }); $("#004").change(function(){ changed1 = true; }); Thus you can keep the log of which all inputs have been changed. Answer to 2nd, I don't understand why are you even asking this, $('#001').change(function(){ alert("If

Categories : Jquery

Rails - How to handle requiring different administrator approval depending on the change being made
It'd be worth looking at a gem like cancan. You can define abilities there which would, I believe, allow you to model what you're describing. So, for example, you could define your abilities: class Ability include CanCan::Ability def initialize(user) can :manage, Project, :state_id => user.state_id end end And you can then check abilities to if your user can perform actions on a project in your controller, say: if can?(:update, @project) ... else flash[:notice] = 'You can only manage projects in your state.' end Cancan can do a lot more than just this simple example but that gives you some idea of what's possible.

Categories : Ruby On Rails

VBA trigger macro on cell value change
Could you try something like this? Change the formula to =D3AlertOnChange(B3*C3). Private D3OldVal As Variant Public Function D3AlertOnChange(val) If val <> D3OldVal Then MsgBox "Value changed!" D3OldVal = val D3AlertOnChange = val End Function

Categories : Excel

Macro to copy rows from multiple workbook to summary workbook with matching column value
I'm not entirely sure I understand what you're after...But. Open all the workbooks that you want copied. Paste the following code into a standard module in one of the workbooks (it doesn't matter which one) Run it. The code creates a new workbook and looks at every cell in row 1 of every workbook in every worksheet. (apart from the one that's just been created) If it isn't blank it copies the entire column into the new workbook in the same worksheet number and in the same column position. Cheers. Sub alltoone() Application.ScreenUpdating = False j = 0 ght = 0 Set nwrk = Workbooks.Add For i = 1 To Workbooks.Count - 1 ght = Application.WorksheetFunction.Max(ght, Workbooks(i).Worksheets.Count) Next i If ght > nwrk.Worksheets.Count Then Do nwrk.Worksheets.Add Loop Until gh

Categories : Vba

How to copy all tables and charts from all sheets of excel to powerpoint using Macro (VB) in Excel
For pictures try using shapes from How to select pictures Dim Pic As Shape For Each Pic In ActiveSheet.Shapes If Pic.Type = msoPicture Then Pic.Select 'do something with image End If Next Pic

Categories : Vb.Net

count total clicks made by user on entire site and change background accordingly
You can do that easily with jQuery: EDIT with $.cookie usage: var totalClicks = ($.cookie('totalClicks' !== null) ? $.cookie('totalClicks') : 0; var clicksLimit = 10; $.cookie('clicksLimit', clicksLimit); // just so that you do not have to re-declare this variable on the other page. $('body').on('click', '*', function() { totalClicks++; if(totalClicks >= clicksLimit) { alert('do something here...'); // precise to your request: $('body').css('background-color', '#f00'); // will turn body background to "red" } $.cookie('totalClicks', totalClicks); });

Categories : HTML

VBA - Detecting a cell change within the context of a macro
Excel-VBA is capable of performing all what you are after. But you are asking for too much and not providing anything (usually, the asker has to include a code or any kind of indication of what he/she tried and why failed). As a rough introduction (some guidelines to help in the research/start coding/ask more precise questions process): Ask user to select column of interest -> a message box (MsgBox). Listen for cell click -> method triggered by the selection change event of the given worksheet (Worksheet_SelectionChange in the given Worksheet VBA file, that is, under Microsoft Excel Objects). Extract the features of the column chosen by the user -> you have to get some insight into Ranges, more specifically Cells, Rows and Columns. Apply relevant features in area of the worksheet where

Categories : Excel

VBA Macro to Copy Range and Paste range to PPT as Picture
something like this Sub BetterPicturePaste() '...other stuff... Windows(1).Sheets(1).Range("myrange").Copy Windows(2).View.PasteSpecial DataType:=ppPasteEnhancedMetafile End Sub

Categories : Excel

Why are values of input fields persisting after navigation with Jquery Mobile - even if attempts are made to change them?
This might help you: Within the < head> section, do the following, <script> $(document).on('pagehide', function(e){ $(e.target).remove(); }); </script> This will remove any existing page cache in dom. As you may know, the first page (full reload) remains in dom after visiting others.

Categories : Jquery

Run a macro when certain cells change in Excel but from my Personal workbook
Since I faced the same problem, I worked my way through Chip Pearson's instructions and will provide you with a more comprehensive guide. I can also really encourage you to read your way through Chip Pearson's great summary on events. I know it's a lot to digest, but it will greatly help you understand what we actually do here. As an overview, these are the steps we are going to perform: Add a class module for our event handlers (This is where the actual event handling code will go) Add an event handler to our personal.xlsb's ThisWorkbook module to wire-up our event handler class Enjoy infinite event handling loops because we changed the Target.Value :-P (optional) Let's get started. 1. Add a class module First, we need to create a cozy plaze to put all our event handlers. We will

Categories : Excel



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.