pasting to the last column in a specific row

mprimrose

New Member
Joined
Sep 12, 2016
Messages
2
Hi, I'm new to VBA and trying to come up with a code for work.

I keep a log of accounts with comments and I am trying to create a macro that will allow me to copy old comments from my main sheet and save them in another sheet, to keep a record of all historic comments in the file.

I have successfully created a code to copy the comments and clear the cell so that new comments can be added, but I can't figure out how to make sure I can keep a back log of these comments that can be added to, so that when I paste comments from one account multiple times, I don't end up writing over the old ones in the log.

I'm not sure if this makes any sense, but any help would be greatly appreciated!! Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
When you ask for help here we always need "Details"
You have not given any sheet names or column numbers of where your comments are and where you want them copied to.

You said you have code written already but you have not showed us your code

Assuming your sheet names are ""Sheet1" and "Sheet2"
And your comments are in Column "A" of "Sheet1" and you want them copied to Column "A" of sheet "Sheet2" try this script.

Code:
Sub Copy_Comments()
Application.ScreenUpdating = False
Dim Lastrow As Long
Dim Lastrowa As Long
Sheets("Sheet1").Activate
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Lastrowa = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row + 1
Sheets("Sheet1").Range("A1:A" & Lastrow).Copy Destination:=Sheets("Sheet2").Range("A" & Lastrowa)
Sheets("Sheet1").Range("A1:A" & Lastrow).ClearContents
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Apologies for the lack of details.

My Comments are in Sheet 1 and I am pasting into Sheet 2. The only struggle I am having is that I only need to copy over the comments and re-paste them when someone goes into that particular cell and wants to update the comments. I want to be able to run a macro that allows them to copy the comments of that particular cell, and paste them in a back sheet that corresponds to that same item (aka that same, unique line item). They all correspond to different account numbers. My code thus far is as follows:

Sub Range_copy()
Dim cellwant As Variant
Dim cellhistory As Variant
Dim LRow As Variant

Worksheets("AAG").Select
Worksheets("AAG").Range("I3").Select
cellwant = Selection.Value
Worksheets("AAG").Range(cellwant).copy
Worksheets("Sheet2").Activate




Worksheets("Sheet2").Range("A1").Select
Selection.End(xlToRight).Select
LRow = Selection.Column
 
Upvote 0
I'm still not understanding.
I will let someone else here at Mr. Excel help you.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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