Macro to Lookup an item and bring its comments!

amattey

New Member
Joined
Jul 18, 2011
Messages
46
Hello,

I have a spreadsheet that creates a new tab monthly with new data. However, sometime the new month data might have some repeated from the past month in which we input some comments. Is there a VBA macro to lookup similar data from the current month tab into the last month tab and bring the comments? Could anyone help? Will much appreciate the help.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
This is what I have but does not seem to work:

Code:
Sub Get_Manual_Comments()
     
     Dim p As String
     Dim mon As String
     Dim ye As String
     
     mon = Month(Now() - 1)
     ye = year(Now())
     
     
     p = Sheet.mon & ", " & year
     
     Sheets(Format(Now(), "mmmm, yyyy")).Activate
     Range("I7").Select
     ActiveCell.FormulaR1C1 = "=IF(RC[-3]=VLOOKUP(RC[-3],p!C6:C9,4,FALSE),=VLOOKUP(RC[-3],p!C6:C9,4,FALSE),"""")"
     Range("I7").Select
     Selection.AutoFill Destination:=Range("I7:I12"), Type:=xlFillDefault
     Range("I7:I12").Select
 
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,572
Members
452,927
Latest member
whitfieldcraig

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