I have some Sql queries inside VBA code, this is an example of a line of code:
strQry = strQry & Worksheets("Data").Cells(9, 7) & """, " & _
I need to add a comment at the end of this line. Like this:
strQry = strQry & Worksheets("Data").Cells(9, 7) & """, " & _ 'comment hjjkk
I usually comment using an apostrophe but the character is not accepted on that line. Please advise. Also, I need the comment on that exact line if possible, at the end of it.
Thank you!
If you do
& _it means you got code on the next line and that instruction is not finished.So if you type a comment right after
& _it’s like if your inserting a comment in the middle of your instructionFor example:
So all you can do is
or in your case it would look like this