Hi,
Can anyone help me w/ a macro that will take the comments from "Sheet 2" and paste it into the corresponding cell on the "Notes" tab for the specific name and month indicated on "Sheet 2"?
Thank you so much!
Hi,
Can anyone help me w/ a macro that will take the comments from "Sheet 2" and paste it into the corresponding cell on the "Notes" tab for the specific name and month indicated on "Sheet 2"?
Thank you so much!
Last edited by janeml; 08-28-2013 at 10:43 AM.
Place this macro in the code module for worksheet Sheet2. First fill in the name and month and then the Comments. When you exit the Comments cell, it will be copied to sheet "Notes".
![]()
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("B2")) Is Nothing Then Exit Sub Application.ScreenUpdating = False Dim bottomA As Integer bottomA = Sheets("Notes").Range("A" & Rows.Count).End(xlUp).Row Dim rowRng As Range Dim colRng As Range For Each rowRng In Sheets("Notes").Range("A3:A" & bottomA) For Each colRng In Sheets("Notes").Range("B2:M2") If rowRng = Sheets("Sheet2").Range("E1") And colRng = Sheets("Sheet2").Range("E2") Then Target.Copy Sheets("Notes").Cells(rowRng.Row, colRng.Column).PasteSpecial xlPasteValues Application.CutCopyMode = False End If Next colRng Next rowRng Application.ScreenUpdating = True End Sub
Last edited by Mumps1; 08-27-2013 at 12:56 PM.
Hi Mumps1,
Thanks for the reply. I keep getting an error "Argument not optional"...
Jane
Hi Jane. I'm not getting the error. Try the attached file.
Hi Mumps,
How can I get it so it's a public macro instead of a private macro? I would like to add a button that runs the macro when needed.
Thanks!
Jane
Hi Jane. The way it works in the sample file I attached is that the copying of the comments happens automatically when you fill in cell B2 in "Sheet2" and exit the cell. This saves you from having to click a button. If you don't want the copying to happen automatically, then place the following code into a regular module, create your button and assign the macro to it. If you choose to use a button, delete the macro from the worksheet code module otherwise the copying will continue to happen automatically.
![]()
Sub CopyComments() Application.ScreenUpdating = False Dim bottomA As Integer bottomA = Sheets("Notes").Range("A" & Rows.Count).End(xlUp).Row Dim rowRng As Range Dim colRng As Range For Each rowRng In Sheets("Notes").Range("A3:A" & bottomA) For Each colRng In Sheets("Notes").Range("B2:M2") If rowRng = Sheets("Sheet2").Range("E1") And colRng = Sheets("Sheet2").Range("E2") Then Sheets("Sheet2").Range("B2").Copy Sheets("Notes").Cells(rowRng.Row, colRng.Column).PasteSpecial xlPasteValues Application.CutCopyMode = False End If Next colRng Next rowRng Application.ScreenUpdating = True End Sub
Last edited by Mumps1; 08-28-2013 at 08:06 AM.
Got it!!! Thanks Mumps1!![]()
My pleasure.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks