kas
12-06-2015, 07:52 PM
Hi,
I am sure my question is not new, I tried some of the suggestions given before on the Forum, but the codes do not seem to be working in my case. So I have to ask again.
I have a macro like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Select Case Target.Column
Case Is = 4, 5, 6, 7
Call Macro2
Call Macro3
End Select
Application.EnableEvents = True
End Sub
Now I want to add something in it. So currently, after the above VBA code is run, the active sheet is 'Sheet 2'.
I would like to copy Column AD (or AD1:AD51 where AD1 has the name of the column and from AD2:AD51 are the numbers) in 'Sheet 2' to Column P in 'Sheet 1', and want 'Sheet 1' to be the active one. In other words, I want the macro to end in 'Sheet 1', so that I don't have to come back to 'Sheet 1' manually.
So I am not sure if to activate 'Sheet 1' first or to copy the column from 'Sheet 2' to 'Sheet 1' first, or whether copying from 'Sheet 2' to 'Sheet 1' will automatically activate 'Sheet 1' anyway.
After Application.EnableEvents-True command above I tried using:
Worksheets("Sheet 1").Range("P1").Value = Worksheets("Sheet 2").Range("AD1").Value
but this is not working. Should it be the other way round?
Any help will be greatly appreciated, I am quite stuck with this.
I am sure my question is not new, I tried some of the suggestions given before on the Forum, but the codes do not seem to be working in my case. So I have to ask again.
I have a macro like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Select Case Target.Column
Case Is = 4, 5, 6, 7
Call Macro2
Call Macro3
End Select
Application.EnableEvents = True
End Sub
Now I want to add something in it. So currently, after the above VBA code is run, the active sheet is 'Sheet 2'.
I would like to copy Column AD (or AD1:AD51 where AD1 has the name of the column and from AD2:AD51 are the numbers) in 'Sheet 2' to Column P in 'Sheet 1', and want 'Sheet 1' to be the active one. In other words, I want the macro to end in 'Sheet 1', so that I don't have to come back to 'Sheet 1' manually.
So I am not sure if to activate 'Sheet 1' first or to copy the column from 'Sheet 2' to 'Sheet 1' first, or whether copying from 'Sheet 2' to 'Sheet 1' will automatically activate 'Sheet 1' anyway.
After Application.EnableEvents-True command above I tried using:
Worksheets("Sheet 1").Range("P1").Value = Worksheets("Sheet 2").Range("AD1").Value
but this is not working. Should it be the other way round?
Any help will be greatly appreciated, I am quite stuck with this.