Copying multiple lines cells into comment - not working for long strings- VBA

uolip17

New Member
Joined
Jan 21, 2017
Messages
1
Dear all,

I've been using the website for long time now, always finding the resources I needed to keep on building my sheets.
However I have been struggling with the following for a few hours, and can't find a proper answer, anywhere, so far...

Situation:
I have a whole sheet of numbers, used as a recap from a database. My idea is to sum up what builds up each cell in its comment, through a VBA.

The way I worked on it:
  1. I create the exact same sheet layout with no numbers, but comments instead
  2. I create a macro to copy all cells content to cell comments
  3. I copy the entire sheet comments to the recap sheet

Each cell with the content that will be used as formula is build up by a formula and looks like that:

abcd
1a1b1c1a1 - b1 - c1
2a2b2c2a2 - b2 - c2
3a3b3c3a3 - b3 - c3
...............

<tbody>
</tbody>

I then put all of it together with +concatenate(d1,char(10),d2,char(10),c2) to have them nicely arranged.


I then run the macro:

Sub CellToComment()


Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Select range"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
Rng.NoteText Text:=Rng.Value
Next


End Sub

I select the range (or for my test, my cell), and it gives the cell content as comment, as planned.

Issue:
When I try it for a real scenario, with long strings, it does not.
It takes 2 lines for long strings maximum.

Any idea...?

I thank you in advance for your time!
Best regards,
uolip17
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,214,982
Messages
6,122,573
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top