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
  • Learn & ask questions
Solved

Combine two macros as one

Posted on 2016-08-18
7
43 Views
Last Modified: 2016-08-18
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)
        If Target.Address = "$B$3" Then
        Call CopyandPasteValues
    End If
End Sub

Open in new window

0
Comment
Question by:route217
7 Comments
 
LVL 18

Assisted Solution

by:xtermie
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

Open in new window

0
 
LVL 30

Accepted Solution

by:
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
If Target.Address = "$B$3" Then
   Call LoadData
   Call CopyandPasteValues
End If
End Sub

Open in new window

0
 
LVL 26

Assisted Solution

by:ProfessorJimJam
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

Open in new window

1
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 30

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41760824
Good to see you Professor after a long time. :)
1
 
LVL 26

Expert Comment

by:ProfessorJimJam
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

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

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41760984
You're welcome. Glad to help.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question