Amexxx1

Closed
Amexxx1 - Apr 23, 2015 at 10:56 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 28, 2015 at 11:10 AM
Hello,

I don't seem to be able to run this simple code; I copy and paste but when trying to run in my General tab by pressing alt+F8, no macro is found... can you please help me? Thanks.


2 responses

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 23, 2015 at 11:29 AM
What code Amexxx1?

Did you put the code in a Module?

Here is how:
https://www.ablebits.com/office-addins-blog/2013/12/06/add-run-vba-macro-excel/

Let us know the first code line to know where it is supposed to go.

Best regards,
Trowa
Hi! Many thanks for your quick response!

What I need:
I'm trying to copy certain rows of an excel sheet to different sheets, depending on a client name. So I have my parent sheet, containing billing info, among which there is a column header stating the client name.I need to autopopulate a second sheet named e.g. "Client1", with all the rows pertaining to "Client1" in the parent sheet;, the same thing with "Client2", etc. So all I need is to extract rows from a parent sheet and automatically populate specific sheets as a function of the client name.

What I found:
I found your code
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("H:H")) Is Nothing Then Exit Sub

If Target.Value = "General" Then
Range(Range("C" & Target.Row), Range("H" & Target.Row)).Copy _
Sheets("General").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)

ElseIf Target.Value = "1ste Group" Then
Range(Range("C" & Target.Row), Range("H" & Target.Row)).Copy _
Sheets("1ste Group").Range("C" & Rows.Count).End(xlUp).Offset(1, 0)

End If

End Sub

My problem:
I have never worked with excel and when I paste this in the module I create, exit and press alt+F8 to run, I can select no macro to run on the parent sheet.

Thanks again for your help.

Amex
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 28, 2015 at 11:10 AM
Hi Amex,

The code needs to be put into parent sheet and will run automatically whenever a change is made to column H (in this code).

May this picture guide you:


Where it says "Blad1 (Blad1)" it will probably say "Sheet1 (Parent)" in your excel file.

Best regards,
Trowa