Userform: Delete All Content Through Double Click But Not The Highlighted Line
Jan 7, 2010
I have a worksheet in whichs Column A Cells , there is corresponding string content in Col. Z. Some cells of column Z contain of many lines (up to 100 line) which i want to reduce to one. I want to select one line through double clicking in the listbox of the userform and all other lines should be deleted and only the clicked one should remain. Code should then jump to the next non empty Z cell.
Columns B, C, D, E, F, G and H should also be shown in the userform and they should be live editable. I have attached and example file with userform and example data.
I have a userform that has a listbox that contains data in 7 columns. I also have a command button that when clicked allows the user to edit the data in whatever row of the list box is highlighted. This works fine.
I decided to have a double click in the listbox on a row do the same thing. So I simply picked the double click event and called the command button sub. When I try this, it runs the command button sub, but then it runs the userform Activate sub. This is a problem as it does things that I do not want to occur again.
I then decided to put the command buttom code in a separate sub and then call that sub on the double click -- same result.
Then I just put the exact code that I have in the command button into the double click event -- still does it.
Anyone know why this happens, I see no reason for it. It works great in the command button, but with double-click it run the userform Activate sub when it is done.
Here is the code that runs (if called by a command button it works fine, if called by a double_click in the listbox, it runs the userform_activate sub):
I've found the code below and tweaked to suit my needs but having trouble. Had it working one time. The code below calls a userform when the user double clicks on a cell. The form pops up and is not active/enabled. I cannot select anything on the form until I select a cell on the sheet, then everything on form becomes active/enabled.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'check cells for desired format to trigger the frmSel_WBS.show routine 'otherwise exit the sub Dim NumberFormat, DF NumberFormat = Array("[Blue]General") For Each DF In NumberFormat If DF = Target.NumberFormat Then frmSel_WBS.Show vbModeless End If Next End Sub
following on from previous post (http://www.excelforum.com/excel-prog...g-up-form.html) what if the selected cell is a merged cell (cell count is greateer than 1), what is the best solution to enable double click event on merged cell ?
i've got a form that shows employee data in labels, and i'd like the user to be able to double click a label to change it (using a pop-up form). is it possible to get the pop-up to show after a double click instead of a single click?
I have spreadsheet with client names. I'd like to build logic that will open a form with client information when a user double-clicks on the client name. But I have a couple of problems.
- First, I'd like to protect the sheet and hide the formulas. But when I protect the sheet, I get the "the cell or chart you are trying to change is protected" error when I double click the protected cell.
- If I deselect the "Select Locked Cells" options when I protect the sheet, I no longer have the ability to double-click on the cell.
how I can double click on a cell yet not allow the user to edit the cell (or see the formula)?
I am trying to create a data entry sheet to enter quotes on. When a quote is received, I click on my "Add quote" button and a userform appears. Data is entered into the userform (frmEntryForm) and returned back to the next available row.
I also need to be able to:
Edit a row by double-clicking it. When a row is double-clicked, data from that row is passed back to the userform, edited and returned back to the same row (to prevent duplicates).Validate that all fields are complete within the userform where relevant (i.e. if the work is not complete or in progress then the "Invoice Number" and "Actual Cost" fields are disabled and blanked to prevent entry (I think this is almost sorted judging by my tests)
I have attached my sheet : 2014 Gatwick Quote Log (Macro Enabled).xlsm
I am trying to write some questions on cells of Sheet1 of a workbook. Then I want to write the answers on cells of Sheet2 of the same workbook. I want the user to be able to double click the question-cell on Sheet1 and be taken to the respective answer on Sheet2.
I have a spreadsheet that just uses the basic "SUM" function. This morning I went to use it and the function does not work after I change a number within the field of that function. If, however, I go into the SUM function and double click, then hit enter, it does the new calculation.
I have this list of all rangenames in my workbookin column A:A
For some reason I want to doubleclick on the rangename in the list to activate this range.
The reason is that I want more smooth activation-prosess; The Excel Range List is too long to practical use as a direct lookup, so I want to activate directly from my own list (where i have added definitions to the range names.
I have tried to build a hyperlink formula, but failed. Maybe the macro below can be modified to do the job, but I am stuck here as well.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim RangeName Application.ScreenUpdating = False If Target.Count > 1 Then Exit Sub If Not Intersect(Target, Range("A:A")) Is Nothing Then Cancel = True
I seem to have broken something!. Whenever I double-click to open an Excel file (.xls files are associated correctly), Excel opens, but nothing happens. That status bar says "Ready," but my workbook never appears.
If I do a File-> Open within Excel, then I am able to open the workbook. I have no idea what is going on. This occurs for all Excel files whether they contain macros or not.
I have a code for doubleclick on a cell and a gdt application chart will open.
Private Sub Worksheet_BeforeDoubleClicK(ByVal Target As Range, Cancel As Boolean) ActiveSheet.Unprotect ThisWorkbook.Unprotect Dim i As Integer Dim gdt As Long Dim S As String Cancel = True With Application
If Target.Address(False, False) "C11" Then Exit Sub
'Place your direct path to open this GDT application
S = "C:Documents and SettingsUserMy DocumentsAndy's MachineINSPECTIONGDTGDT BitmapGD&T_Font.exe"
If Dir(S) = "" Then MsgBox "File does not exist:" & vbCrLf & S, vbCritical, "Error" Exit Sub End If gdt = Shell("""" & S & """", vbNormalFocus)
ActiveSheet.Protect ThisWorkbook.Protect End Sub What would the code be for a range of cells if doulbe clicked the range would be C11 thru C35
Also, I have a double click code for another symbol chart to open.
How, would this be used in the same manner if a coulmn or row were to apply on double click.
on the worksheet there are six ranges...each range has three columns...the first is team name, the second is rep name, and the third is the metric being measured.
what i would like to happen is...
when a team name is double clicked in any one of the ranges, i would like all three cells (team name, rep name, and metric) to be boldfaced and have the cell interior change color for all instances across all six ranges that match the team name double clicked. when double clicked again, it should go back to original formatting.
likewise, when a rep name is double clicked in any one of the ranges, i would like all three cells (team name, rep name, and metric) to be boldfaced and have the cell interior change color for all instances across all six ranges that match the rep name double clicked. when double clicked again, it would go back to original format.
so for example, if i happen to click on a cell in the team column in the second range for "team a", all cells in each range (including the adjacent cells for rep and metric) would be highlighted.
I have populated a listbox from a filtered list and when 'Double Clicking' a name I want a macro to run. All seems to be OK apart from it is not finding/returning any data; I know the data is there and I think it may be the way I'm referencing the listbox value;
Dim DestSheet As Worksheet Set DestSheet = Worksheets("Clients to Invoice")
Dim sRow As Long 'row index on source worksheet Dim dRow As Long 'row index on destination worksheet Dim sCount As Long sCount = 0 dRow = 1...................
I am trying to create code so that when a cell in Column C (for example C1) is double clicked, it makes the font bold, italicized, blue and inserts a row below the double clicked cell. I am also trying to make it so that if the cell is double clicked again, it removes the bold, italics, blue and deletes the row that was previously inserted.
Private Sub Worksheet_BeforeDoubleClick _ (ByVal Target As Excel.Range, Cancel As Boolean) If Target.Font.Bold Then ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select Selection.Insert Shift:=xlDown ActiveCell.Select Cancel = True If Not Target.Font.Bold Then ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select Selection.Delete Shift:=xlUp ActiveCell.Select Cancel = True End If End If End Sub
I want a X to be put in the activecell if empty or removed if already there. By searching this forum I found and read the article "Adding a Command Button to the Excel Right Click Pop-up Toolbar/Command Bar" and was able to add the code to do this to the right click sub menu. Is there a way to do the same thing by double clicking on the cell? This probably seems a bit nit pickey but I would just like for it to work using double click for my users. I wrote the following code to performe the action
Sub Toggle_Macro() If IsEmpty(ActiveCell) = True Then ActiveCell.Value = "X" With Selection .HorizontalAlignment = xlCenter End With With Selection.Font .Name = "Arial" .FontStyle = "Bold" .Size = 12 .ColorIndex = 3 End With Else: Selection.ClearContents End If End Sub
And placed the code below in Private Module of the Workbook Object.................
I am trying to run a macro when I double click on a certain cell (D34). The cell has data in it (Southeast NSC). What I am expecting to happen is once I double click on the cell the macro will run the retrieve and I will end up at expense chart page.
The macro I am trying to run is an Essbase retrieve.
Testing my worksheet, I found that if I double click on any cell that is not locked, the worksheet becomes unprotected. I need to prevent this from happening. I tried the following code, but it didn't work.
I'm using a little sub routine to bring up a pop up calendar when i click in a cell, everythings lovely but it annoyingly comes up when i select a clolumn or row that also contains that cell. modification to require a double click to display the calendar?
I have a sheet with some 300 plus rows of data. I use filters to sort through the rows to get down to anywhere from 8 to 10 or so rows. At that point I would like to be able to select (doule click) a filtered row of 10 cells (A:J) copy the data and paste it to a different sheet starting with cell B18. I want to be able to perform this process up to 5 seperate times.
I have recorded a macro to do basically what I am trying but with many short falls. It only selects one row, I cannot double click on a row and it dosen't always paste to the proper cell.
I want to be able to double click on a cell in a column. If it has a certain word in it, it will take it to that worksheet. Auto filters are used so these cells can move in a column at any time. This is why I am looking for a code to validate the contents in the cell first.
ie. Cell has the word: BSALT, when double clicked it will take it to the BSALT worksheet.
Cell has the word MLW, when double clicked it will take it to the MLW worksheet.
And so on.
These values are in one column only. If they weren't able to be autofiltered i could do it, but the mere fact that they can move around is giving me trouble.
Is it possible to create a menu that could be called by a double click which would allow you to click on a value from that menu and insert it into the double clicked cell. I know I could use a data validation list, but that is tacky and you have to scroll down the list to find the data you would like. I'd like to have a menu pop up that stores different values in 6 columns and 25 rows. Any way without having to jump into an access database?
I would like to create a macro in which, when the user double clicks on a cell, that cell will be shaded yellow and other cells within the Workbook containing the same value as that cell will be crossed out. I have come up with the below code, but it doesn't work correctly. Any ideas on what I have done wrong? Would also like it to not cross out the cell the user double clicked on.
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Dim wk As Worksheet Dim selectedName As String selectedName = ActiveCell.Value
With Selection.Interior .ColorIndex = 6 .Pattern = xlSolid End With
For Each wk In ActiveWorkbook.Worksheets
For i = 200 To 2 Step -1 If ActiveSheet.Cells(i, 2).Value = selectedName Then ActiveSheet.Cells(i, 2).Font.Strikethrough = True End If Next Next End Sub [/code]
i have some code that allows my users to enter their user ID on double clicking. The worksheet code below shows how on double clicking into Colum 3 (If Target.Column = 3 Then) then the user ID will appear. Q: How do i get the code to work in Columns 3, 5 and 7 but not those inbetween?! I tried using "or" but it allowed the ID to be entered into all columns! i.e. 3,4,5,6 and 7 which is not what I require. In short I need the ID to appear on double clik into every other column.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim user As String 'This refers to the function ReturnUserName, which takes the name from the NT environment
If Target.Column = 3 Then Target = ReturnUserName Cancel = True End If