Can I have a VBA code that will do the following: When I double click on a cell in…
- User
Can I have a VBA code that will do the following: When I double click on a cell in column A from row 2 downwards, provided that the cell is not empty, find the value match in column A of sheet 'Task Issues', activate the sheet 'Task Issues' and select the cell in column A where the match is found.
- Assistant
- User
Please can I have a simple VBA code that can do the following: when a cell is selected in a row from A to C, the row from A to C is highlighted yellow. When you select another cell the formatting is cleared and the new cell is highlighted yellow
- Assistant
Certainly! Below is a simple VBA code that accomplishes your request. This code will highlight the entire row from columns A to C in yellow when you select a cell within that range, and it will clear the previous highlighting when a new cell is selected.
- User
Can I have a VBA code that will do the following: When I double click on a cell im column B, If there is no value in column C of the Target Row pop up a message "Issue cannot be archived without a Date" and exit the sub. If there is a value in column C of the Target Row Then copy the target row from A to D and paste the values only into the next available row in sheet 'Issue History'
- Assistant
- User
Can you kindly adjust the VBA code below to do the following: When I double click on a cell im column B, After checking for values in C First clear any cell comments if there are any, continue with the copy and paste to sheet 'Issue History' After the paste, and a comment to the Target cell in column B "History filed for this Task " & date Then clear the contents only of the Target cell in column B
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim wsHistory As Worksheet Dim nextRow As Long
' Check if the double-click occurred in Column B If Not Intersect(Target, Me.Columns("B")) Is Nothing Then ' Cancel the default double-click action Cancel = True ' Check if the corresponding cell in Column C is empty If IsEmpty(Me.Cells(Target.Row, "C").value) Then MsgBox "Issue cannot be archived without a Date", vbExclamation Exit Sub End If ' Set reference to the 'Issue History' sheet Set wsHistory = ThisWorkbook.Sheets("Issue History") ' Find the next available row in 'Issue History' nextRow = wsHistory.Cells(wsHistory.Rows.count, "A").End(xlUp).Row + 1 ' Copy the entire row A:D from the current sheet to the next available row in 'Issue History' Me.Range(Me.Cells(Target.Row, "A"), Me.Cells(Target.Row, "D")).Copy wsHistory.Cells(nextRow, "A").PasteSpecial Paste:=xlPasteValues ' Clear the clipboard Application.CutCopyMode = False End If - Assistant
- User
I have a picture loaded on my page. Previuosly, this vba code would clear the immage. But it is no longer doing so.
If Target.CountLarge > 1 Then Exit Sub If Not Intersect(Target, Me.Range("F3")) Is Nothing Then Me.Unprotect Password:="edit" ' Check if Image Exists and then delete Dim pic As Shape Set sP = ThisWorkbook.Sheets("Start Page") Dim picFound As Boolean picFound = False ' Loop through each shape in the worksheet For Each pic In sP.Shapes 'On Error GoTo HandleError If pic.Type = msoPicture Then picFound = True pic.Delete Exit For End If
- Assistant
- User
in VBA there is pic.Delete. Is there a pic.Hide
- Assistant
In VBA, shapes (including pictures) can indeed be hidden, and this can be achieved using the
Visibleproperty of the shape. Specifically, you can set the shape to be invisible without deleting it. You can use the following code to hide a shape: