Solved

Combine two macros as one

Posted on 2016-08-18
7
47 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
[X]
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
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 31

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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 31

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 31

Expert Comment

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

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

691 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