## Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

• Help others & share knowledge
• Earn cash & points
Solved

# Combine two macros as one

Posted on 2016-08-18
43 Views
Hi Experts Using Excel 2013

How would i combine the two together so macro one runs then two runs...

``````Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("\$B\$3")) Is Nothing Then LoadData
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Call CopyandPasteValues
End If
End Sub
``````
0
Question by:route217

LVL 18

Assisted Solution

xtermie earned 125 total points
ID: 41760791
Hi, something like this?
``````Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("\$B\$3")) Is Nothing Then LoadData
If Target.Address = "\$B\$3" Then Call CopyandPasteValues
End Sub
``````
0

LVL 30

Accepted Solution

Subodh Tiwari (Neeraj) earned 250 total points
ID: 41760821
Why not only this.....

``````Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
Call CopyandPasteValues
End If
End Sub
``````
0

LVL 26

Assisted Solution

ProfessorJimJam earned 125 total points
ID: 41760822
you can remove unnessesary trigger of B3 which both line are doing the same thing. so here it goes simplified.

``````Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("\$B\$3")) Is Nothing Then LoadData
Call CopyandPasteValues
End Sub
``````
1

LVL 30

Expert Comment

ID: 41760824
Good to see you Professor after a long time. :)
1

LVL 26

Expert Comment

ID: 41760826
Thanks Neeraj,

likewise. good to see you too.

yes, it been a long time :-) i have been away summer holidays.
0

Author Comment

ID: 41760836
Thanks all excelled as always..and excellent feedback..see the error.
1

LVL 30

Expert Comment

ID: 41760984
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.