markpem
02-16-2015, 05:00 AM
Hello
I currently have the following code (which works a treat) and it puts all the data in A2, B2, C2, D2 etc into a comment in A2.
However I also have headers in A1, B1, C1, and I would like them adding like the screenshot if anyone could give me the code?
Thanks!
Current Code:-
Dim cmt As Comment
Dim rng As Range
Set rng = Range("A1")
Do
Set cmt = rng.Comment
If cmt Is Nothing Then
rng.AddComment
Set cmt = rng.Comment
End If
cmt.Text Join(Application.Transpose(Application.Transpose(rng.Resize(, 6).Value)), Chr(10))
cmt.Visible = True ' optional
Set rng = rng.Offset(1)
Loop Until rng.Value = ""
Click on picture:-
12857
I currently have the following code (which works a treat) and it puts all the data in A2, B2, C2, D2 etc into a comment in A2.
However I also have headers in A1, B1, C1, and I would like them adding like the screenshot if anyone could give me the code?
Thanks!
Current Code:-
Dim cmt As Comment
Dim rng As Range
Set rng = Range("A1")
Do
Set cmt = rng.Comment
If cmt Is Nothing Then
rng.AddComment
Set cmt = rng.Comment
End If
cmt.Text Join(Application.Transpose(Application.Transpose(rng.Resize(, 6).Value)), Chr(10))
cmt.Visible = True ' optional
Set rng = rng.Offset(1)
Loop Until rng.Value = ""
Click on picture:-
12857