JEH105
New Member
- Joined
- Oct 11, 2019
- Messages
- 35
- Office Version
- 365
- Platform
- Windows
Hello everyone! I don't even know if this is possible, but worth a shot? Thank you for your time in advance!
I need help with a VBA code that can add "COVERING" text to an empty cell in Sheet 2, based on the value of Sheet 3. It will be for specific columns, for example Sheet 1, Column G based on the data on Sheet 3, column G. The text should only be added to the cell to which the criteria applies. (e.g. Cell G15 in sheet 2 has "8", then Cell G15 in sheet 3 gets "COVERING" text added.)
This is what I have so far, but it's not working:
Important:
I need help with a VBA code that can add "COVERING" text to an empty cell in Sheet 2, based on the value of Sheet 3. It will be for specific columns, for example Sheet 1, Column G based on the data on Sheet 3, column G. The text should only be added to the cell to which the criteria applies. (e.g. Cell G15 in sheet 2 has "8", then Cell G15 in sheet 3 gets "COVERING" text added.)
This is what I have so far, but it's not working:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheet2.Range("$G10:$G270").Value > 1 Then
Sheet3.Range("$G10:$G270").Value = "Covering"
End If
End Sub
Important:
- Other text will be added/included in both sheet columns (e.g. "Holiday", "U", etc.)
- I only want the cells with number values over 0 to be counted for this VBA in sheet 2. (Ignore the text values)
- If the cell in Sheet 3 has a text/value in place beforehand, I'd like the VBA to be ignored. However, if the cell is cleared, the VBA should add the text according to the criteria.
- If the value in Sheet 2 is deleted, then the same should happen on Sheet 3.
- There may be more than 2 columns compared in the same spreadsheet. Example:
- Sheet 2, Column G with Sheet 3, Column G
- Sheet 4, Column K with Sheet 3, Column P
- etc.
- Another auto calculate VBA is included in the same sheet with the same name. Hence, I get ambiguous name error.