Solved

Combine two macros as one

Posted on 2016-08-18
7
32 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 17

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 28

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 25

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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 28

Expert Comment

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

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 28

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

705 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now