If activeCell.Column = 11 And activeCell.Value <> "" Then how will I adjust this using…
Jump to turn (9)
- 1If activeCell.Column = 11 And activeCell.Value <> "" Then how will I adjust this
- 2The following code used to work. If I entered a value into Column 11, it would c
- 3The following code used to work perfectly. If I entered a value into Column 11,
- 4Private Sub WorksheetSelectionChange(ByVal Target As Range) Application.EnableEv
- 5Originally the line of code read, If Intersect(activeCell, Range(“K1:J2001”)) Is
- 6With respect to my earlier enquiry, the range is now being copied and pasted int
- 7For the sepecific Excel sheet, the workbook calculation is turned of. I enter va
- 8Private Sub WorksheetChange(ByVal Target As Range) 'Application.EnableEvents = T
- 9I have followed your recommendation and used the code below. However, it is stil
- User
If activeCell.Column = 11 And activeCell.Value <> "" Then how will I adjust this using Offset, so that the cell just before the activeCell.Value is <> ""
- Assistant
You can adjust the code using Offset to check the value of the cell just before the activeCell. You can use the following code:
codeIf ActiveCell.Column = 11 And ActiveCell.Offset(0, -1).Value <> "" Then 'Your code here End IfThis code checks if the active cell is in column 11 and also checks the value of the cell just before using the Offset property with (-1) as the second argument. If the value is not empty, then the code inside the
Ifstatement will get executed. - User