Help With Excel Comments - Adding LOTs of variables to a comment via VBA

DaveHappyNorm

New Member
Joined
Jul 22, 2018
Messages
15
Hello

I am trying to add a comment that contains a fair amount of text via a VB macro, but I cannot get the excel to accept the code.

The code I have is:-

Cells((RO + 1), L).Comment.text text:= SIDE_STEP_MAX_COMMENT_MILES & "." & SIDE_STEP_MAX_COMMENT_YARDS & Chr(10) & SIDE_STEP_MAX_COMMENT_SPEED & "mph" & Chr(10) & SIDE_STEP_MAX_COMMENT_DATE & Chr(10) & SIDE_STEP_MAX_COMMENT_RAIL_SECTION & Chr(10) & Chr(10) & "GAUGE S/W = " & SIDE_STEP_MAX_COMMENT_GAUGE_SIDE_WEAR &
Chr (10) & "GAUGE S/S = " & SIDE_STEP_MAX_COMMENT_GAUGE_SIDE_STEP & Chr(10) & Chr(10) & "FIELD S/W = " & SIDE_STEP_MAX_COMMENT_FIELD_SIDE_WEAR & Chr(10) & "FIELD S/S = " & SIDE_STEP_MAX_COMMENT_FIELD_SIDE_STEP & Chr(10) & Chr(10) & "H/W = " & SIDE_STEP_MAX_COMMENT_HEAD_WIDTH & Chr(10) & "H/W REMAINING = " & SIDE_STEP_MAX_COMMENT_HEAD_WIDTH_REMAINING & Chr(10) & "COM S/S = " & SIDE_STEP_MAX_COMMENT_COMBINED_SIDESTEP & Chr(10) & Chr(10) & "V WEAR = " & SIDE_STEP_MAX_COMMENT_VERTICAL_WEAR & Chr(10) & "DEPTH = " & SIDE_STEP_MAX_COMMENT_RAIL_DEPTH & Chr(10) & "F/P CLEARANCE = " & SIDE_STEP_MAX_COMMENT_FISH_PLATE_CLEARANCE & Chr(10) & Chr(10) & "INC= " & SIDE_STEP_MAX_COMMENT_INCLINATION & Chr(10) & Chr(10) & "G/F REM = " & SIDE_STEP_MAX_COMMENT_GAUGE_FACE_REMAINING & Chr(10) & Chr(10) & "LAT = " & SIDE_STEP_MAX_COMMENT_GPS_LAT & Chr(10) & "LONG = " & SIDE_STEP_MAX_COMMENT_GPS_LONG & Chr(10)

As you can see it is very long and I think this is part of the problem. The code contains mostly variables.

Can anyone help with a solution?

Thank you.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Do you know the length of the string you are trying to assign to the comment?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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