PDA

View Full Version : Vba to include comments



steads1980
02-25-2011, 01:59 PM
I want to amend this code so that the comments save with each record but I don't know how to amend the code. Can anyone help? (If anyone could suggest the best way of learning VBA that would be very useful as well).

p45cal
02-25-2011, 05:09 PM
I don't which part of the code you want changing, but you can do it yourself:
Where in the code you have the likes of:
.Cells(lRecRow, 3).PasteSpecial Paste:=xlPasteValues, Transpose:=True add a line next to it (above or below) which is identical except for one thing:
xlPasteValues
changes to:
xlPasteComments

Tinbendr
02-25-2011, 05:39 PM
See if this does what you need.

steads1980
02-26-2011, 12:45 AM
David that is awesome this does what I need it to do. What part of the code did you change?

steads1980
02-26-2011, 01:06 AM
p45cal Thanks for your post

p45cal
02-26-2011, 05:51 AM
p45cal Thanks for your post
nothing like a bit of ambiguity to keep one on one's toes…:yes

Tinbendr
02-26-2011, 06:33 AM
What part of the code did you change? In Module ModData, Sub UpdateLogRecord(), added
.Cells(lRecRow, "X") = Worksheets("Input").Range("G4").Value This copies the comment block from Input sheet to Data sheet.

In Module modViewData; all four Subs get the line
.Range("G4").Value = DataWks.Range("X" & lRecRow).Value When you press the navigation buttons in the View Records frame, this copies the comment from the Data sheet to the Input sheet.

HTH,

steads1980
02-27-2011, 02:21 AM
How to I change the code so it also works with the drop down menu?

Tinbendr
02-27-2011, 07:05 AM
In the worksheet_change event.