Click and Unclick X boxes in VBA excel formula -
I am creating a survey that I want to be straightforward for the end user. I have created a document that operates on a lecture scale, where things do not agree to agree on a 6 digit scale (no answer field). I have questions and options that run on 3 to 152 lines in C in each cell: At present, I have the buyer that can buy X in the box by clicking on a cell, which is a sign of his choice. I also have the option of clicking on an option in the row, and if they choose the second option, then it removes the first x and puts the X in the new cell that they clicked.
What I want here right now, if they keep X in any cell, then click on the same X, my code goes and takes X and change it again with the same X gives. I would not like to change anything in place of X by clicking it, so that it can turn on and off with one click I want to keep it so that if they select the second cell in the same row then the X disappears in the original cell Goes and X pops up in a clicked cell, although I only want to be able to select one cell in each row for each question. Sorry for the length, but I just wanted to be clear here my code is
sub-worksheet synchronization change (Volt target as range) as a dim border Range for Range dim RCL RW = 3 to 152 set rInt = pseudo (target, range ("C" and RW and ": H" and RW)) If not then there is nothing if the application. Worksheet Function. CONTAE (Range ("C" and RV End ": H" & amp; RAW; RW)) 0 then range ("C" and RW and ": H" and RW). Value = "" If there is RCL for each RCL then RCL.values = "" then RCL.value = "X" end if set to the next end, set rInt = nothing rCell = cancel nothing = true Next end of the sub code
Try the code below. Notice I removed your loop; There is no reason for loop through every line, when we can select the row that the user selects and focus on that line. The way I set the rInt
, has changed it, with the CountA
function . Search
, and wrapping the whole process with a test to see if the user has selected a cell in our predefined range (so the code is not useless if other cells are selected).
Option Clear sub-worksheetset selection change (Voltage target as range) 'only run the code if the user has selected a cell in our defined range: If not, address (target, Me.Range ("C3: H152") is nothing, again set the long Dim XLR range as the range dim RYL in the form of 'Directional Variable Dare Range, Range Dim RCL rInt = Me.Range (Me. Cells (Target.Row, "C"), Me.Cells (Target.Row, "H")) If not then nothing So look for the response in our north range. Set xLoc = RInt.Find.Find ("x") If not then xLoc is nothing 'if there was an answer and the reaction was in the same column _' we chose, the reaction Wipe out and exit the sub if Target.Column = xLoc.Column again rInt.Value = vbNullStringExtub sub 'Otherwise, erase the previous reaction and add new feedback, otherwise RINT Value = vbNullString Target.Value = "x" End If 'If No Previous Answers were ... Other: Target. Value = "X" end if end if end if ending sub
Comments
Post a Comment