Script will not paste on Macro3

Status
Not open for further replies.

Ray Rz

New Member
Joined
Jun 19, 2018
Messages
29
I have created a spreadsheet that pulls all data as required but when the code runs to Macro3, it gets hung up and will not paste into my sheet. If someone can tell me what I could use to make this work for a paste of the tab named what is in cell N16, I would appreciate it...
The process runs through the open of Macro3 but not any further.

Code:
Option Private Module




Sub Macro1()


Dim ws As Worksheet
Set ws = Sheets("Start")




MsgBox ("Update may take several minutes,  Click Ok to begin")
Workbooks.Open ws.Range("N10").Value
    
    'Selection.AutoFilter
    
    Range("A1:P224").Select
    Selection.Copy
    Windows("VBA Extractor r57with code V2.xlsm").Activate
    Worksheets("Invoice Summary").Activate
    ActiveCell.Offset(0, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False


Call Macro2(ws)


End Sub


Sub Macro2(ws As Worksheet)


' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+f
'


Workbooks.Open ws.Range("N12").Value
    'Selection.AutoFilter
    ActiveCell.Offset(0, 0).Range("A1:AQ35000").Select
    Selection.Copy
    Windows("VBA Extractor r57with code V2.xlsm").Activate
    Worksheets("Vendor Master").Activate
    
    ActiveCell.Offset(-1, 0).Range("A2").Select
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False




Call Macro3(ws)


End Sub
Sub Macro3(ws As Worksheet)




'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+g
'


Workbooks.Open ws.Range("N14").Value
'Worksheets wks.Range("N16").Activate
'
'
Dim wks    As Excel.Worksheet


On Error Resume Next
    Set wks = ThisWorkbook.Worksheets(Sheets("Start").Range("N16").Value)
On Error GoTo 0


If Not wks Is Nothing Then
    Call wks.Activate
    
        'Worksheets("July 2018").Activate
        Range("A3").Select
    Selection.AutoFilter
    Columns("A:E").Select
    Selection.EntireColumn.Hidden = False
    Rows("3:3").Select
    Selection.AutoFilter
    ActiveCell.Offset(0, 0).Range("A2:BR26000").Select
        ActiveSheet.Range("$E2").AutoFilter Field:=5, Criteria1:= _
        "Vendor"
    Selection.Copy
    Windows("VBA Extractor r57with code V2.xlsm").Activate
    Worksheets("Const. Prog. Rpt Switches").Activate
    ActiveCell.Offset(0, 0).Range("A1").Select
    
    'ActiveCell.Offset(0, 0).Range("A2").Select
    
    Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
        xlNone, SkipBlanks:=False


Call refresh


    End If


End Sub






' Refresh all applicable pivot tables to setup month's data


Sub refresh()
'
' refresh Macro
' refresh data
'
' Keyboard Shortcut: Ctrl+r




' replace with Refresh All (had to remove the check for Enable Background refresh to make it wait)


    ActiveWorkbook.RefreshAll
    
'  Refresh all Pivot tables in all worksheets


Dim shtTemp As Worksheet
Dim pvtTable As PivotTable
 
For Each shtTemp In ActiveWorkbook.Worksheets
    For Each pvtTable In shtTemp.PivotTables
        pvtTable.RefreshTable
    Next
Next
MsgBox ("Update Complete,All data is Up-to date")


End Sub

Thank you,
Ray
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Duplicate https://www.mrexcel.com/forum/excel...ksheet-name-user-input-field.html#post5126509

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

If you do not receive a response, you can "bump" it by replying to it again, though we advise you to wait 24 hours before doing and not to bump a thread more than once a day.

 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

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