Hi,
I need some help. I'm trying to write a VBA code that will allow me to copy and paste a range of cells from sheet to another based on the text entered into a cell.
So far I have this but it is not working
I want the cells D7:D12 in the Sheet DefaultData to be copied to cells L41:L46 on the AD sheet
when Farm Manure is entered to cell C31 in the AD sheet
Thanks!
I need some help. I'm trying to write a VBA code that will allow me to copy and paste a range of cells from sheet to another based on the text entered into a cell.
So far I have this but it is not working
Code:
[COLOR=#212121][FONT=wf_segoe-ui_normal]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]Set Target = Target.Cells(31, 3)[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]If Not Intersect(Target, Range("C31")) Is Nothing Then[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]If Taregt.Value = "Farm Manure" Then[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]Sub CopyPasteToAnotherSheet()[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]Sheets("DefaultData").Range("D7:D12").Copy[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]Sheets("AD").Activate[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]Range("L41:L46").Select[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]ActiveSheet.Paste[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]End Sub[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]End If[/FONT][/COLOR]
[COLOR=#212121][FONT=wf_segoe-ui_normal]End If[/FONT][/COLOR]
I want the cells D7:D12 in the Sheet DefaultData to be copied to cells L41:L46 on the AD sheet
when Farm Manure is entered to cell C31 in the AD sheet
Thanks!
Last edited by a moderator: