One macro triggering another

gmduece

New Member
Joined
Dec 9, 2015
Messages
17
Hello Folks,

I have a macro that seeks out and creates a range from a database:

Sub Title_Number_Search()
Dim SearchValue As String
SearchValue = InputBox("Enter Title Code" & Chr(13) & _
"####")
If SearchValue = "" Then
Exit Sub 'user pressed Cancel
Else
Call SelectAll(SearchValue)
End If
End Sub

Sub SelectAll(fWhat As String)
Dim F As Range, U As Range, fAdr As String
With ActiveSheet.UsedRange
Set F = .Find(what:=fWhat & "*", LookIn:=xlValues, lookat:=xlPart)
If Not F Is Nothing Then
fAdr = F.Address
Set U = F
Else
GoTo None

End If
Do
Set F = .FindNext(F)
If F Is Nothing Then Exit Do
If F.Address = fAdr Then Exit Do
Set U = Union(F, U)
Loop
End With
If Not U Is Nothing Then
U.Select
Else
None: MsgBox fWhat & " not found in active sheet"
End If
End Sub




I want that to trigger the following:




RangePaste Macro
'

'
Selection.Copy
Sheets("Specials").Select
'Selection.PasteSpecial paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
' Selection.PasteSpecial paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
'SkipBlanks:=False, Transpose:=False
'Selection.PasteSpecial paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

Range("G11").Select
End Sub

Any ideas??
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
The syntax should be something like

Code:
Sub Macro1()
    ' do something

    Call Macro2()

    ' do more
End Sub

Sub Macro2()
    MsgBox "hello"
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top