Austinkane6690
New Member
- Joined
- Aug 23, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
What I have happening outside the macro already:
sheet 1 is explicit except when sheet 2 is mentioned
This is inside cell h3 of sheet 1:
If(and(f3=“specific text”,f5=“other specific text”),”value of cell h3 from sheet 2” ,
If(same thing but with different texts, value of cell i3 from sheet 2”
And so on and so forth across 13 columns and 31 rows from sheet 2
Basically, what I want to happen:
If the value of cell h3 on sheet 1 is equal to the value of cell h3 on sheet 2, I want a comment added for h3 on sheet 1 that contains the contents of cell a3 of sheet 2
All of this to be applied from h3 to h33 of sheet 1
I have the following macros that I’ve been trying and failing to adjust to my needs. I am not the best at code, but I can mimic other peoples’ code. Not very useful except when I want to self help.
But I can’t self help because I’m not understanding entirely
Sub ValueToComment()
Dim rCell As Range
For Each rCell In Selection
With rCell
If .HasFormula Then
On Error Resume Next
.Comment.Delete
On Error GoTo 0
.AddComment
.Comment.Text Text:=CStr(rCell.Value)
End If
End With
Next
Set rCell = Nothing
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("D11:E20")) Is Nothing Then Exit Sub
Dim i As Integer
Dim j As Integer
Dim cmt As Comment
i = Target.Row
j = Target.Column
With Worksheets("Classify")
' Determine Column modified by User
Select Case j
'Re-compose Items Comments in Classify worksheet
Case 4
.Cells(18, i).Comment.Text Text:=Target.Value & Chr(10) & Target.Offset(0, 1)
Case 5
.Cells(18, i).Comment.Text Text:=Target.Offset(0, -1) & Chr(10) & Target.Value
End Select
' Define Comment and Bold first segment
Set cmt = .Cells(18, i).Comment
With cmt.Shape.TextFrame
.Characters.Font.Bold = False
.Characters(1, InStr(1, cmt.Text, Chr(10))).Font.Bold = True
End With
End With
End Sub
sheet 1 is explicit except when sheet 2 is mentioned
This is inside cell h3 of sheet 1:
If(and(f3=“specific text”,f5=“other specific text”),”value of cell h3 from sheet 2” ,
If(same thing but with different texts, value of cell i3 from sheet 2”
And so on and so forth across 13 columns and 31 rows from sheet 2
Basically, what I want to happen:
If the value of cell h3 on sheet 1 is equal to the value of cell h3 on sheet 2, I want a comment added for h3 on sheet 1 that contains the contents of cell a3 of sheet 2
All of this to be applied from h3 to h33 of sheet 1
I have the following macros that I’ve been trying and failing to adjust to my needs. I am not the best at code, but I can mimic other peoples’ code. Not very useful except when I want to self help.
But I can’t self help because I’m not understanding entirely
Sub ValueToComment()
Dim rCell As Range
For Each rCell In Selection
With rCell
If .HasFormula Then
On Error Resume Next
.Comment.Delete
On Error GoTo 0
.AddComment
.Comment.Text Text:=CStr(rCell.Value)
End If
End With
Next
Set rCell = Nothing
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("D11:E20")) Is Nothing Then Exit Sub
Dim i As Integer
Dim j As Integer
Dim cmt As Comment
i = Target.Row
j = Target.Column
With Worksheets("Classify")
' Determine Column modified by User
Select Case j
'Re-compose Items Comments in Classify worksheet
Case 4
.Cells(18, i).Comment.Text Text:=Target.Value & Chr(10) & Target.Offset(0, 1)
Case 5
.Cells(18, i).Comment.Text Text:=Target.Offset(0, -1) & Chr(10) & Target.Value
End Select
' Define Comment and Bold first segment
Set cmt = .Cells(18, i).Comment
With cmt.Shape.TextFrame
.Characters.Font.Bold = False
.Characters(1, InStr(1, cmt.Text, Chr(10))).Font.Bold = True
End With
End With
End Sub