tamrob23
Board Regular
- Joined
- Jun 20, 2006
- Messages
- 203
Good Afternoon,
I have a VBA that needs a small tweek. The VBA that is capturing 4 columns and right now all the comments are going into one column. Basically what ever comments that are in columns A,B,C,D,E need to go into columns F,G,H,I,J. Thank you for taking time to read my thread and have a great day!
Function Comment(ByVal incell As Range) As String
On Error GoTo A:
Comment = incell.Comment.Text
Exit Function
A:
Comment = "Doesn't Exist"
End Function
Sub All_Comments()
Dim myrange As Range, myarray() As String
Set myrange = Range("A1:E100")
For Each cell In myrange
If Not Comment(cell) = "Doesn't Exist" Then
k = k + 1
ReDim Preserve myarray(1 To k) As String
myarray(k) = Comment(cell)
End If
Next
For i = 1 To UBound(myarray)
Range("F1").Offset(i - 1) = myarray(i)
Next i
End Sub
I have a VBA that needs a small tweek. The VBA that is capturing 4 columns and right now all the comments are going into one column. Basically what ever comments that are in columns A,B,C,D,E need to go into columns F,G,H,I,J. Thank you for taking time to read my thread and have a great day!
Function Comment(ByVal incell As Range) As String
On Error GoTo A:
Comment = incell.Comment.Text
Exit Function
A:
Comment = "Doesn't Exist"
End Function
Sub All_Comments()
Dim myrange As Range, myarray() As String
Set myrange = Range("A1:E100")
For Each cell In myrange
If Not Comment(cell) = "Doesn't Exist" Then
k = k + 1
ReDim Preserve myarray(1 To k) As String
myarray(k) = Comment(cell)
End If
Next
For i = 1 To UBound(myarray)
Range("F1").Offset(i - 1) = myarray(i)
Next i
End Sub