sjuhl99

New Member
Joined
Jul 28, 2017
Messages
29
Ok so I am recording a Macro (actually not the whole thing, trying to learn to write). My issues is I unhide my udpate sheet "Forecast Update", open "H:\FORECASTING GROUP\Demand Planning\Forecast Reviews\2017 Q4 Review.xlsx" and want to copy and paste from "H:\FORECASTING GROUP\Demand Planning\Forecast Reviews\2017 Q4 Review.xlsx" to book "Forecast Update" however whenever i run the macro it sticks to another tab "Change Log". Can someone please help me? Thank you very much! Code us attached


Sub Attain_Update()
'
' Attain_Update Macro
'


'
Sheets("Forecast Update").Visible = True
Range("A1").Select
Workbooks.Open Filename:= _
"H:\FORECASTING GROUP\Demand Planning\Forecast Reviews\2017 Q4 Review.xlsx"
Range("D11:F11").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("2017 YoY Q4 Review V2-Lite Version.xlsx").Activate
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("E2").Select
Application.CutCopyMode = False
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=TRIM(RC[-4])"
Range("E2").Select
Selection.Copy
Range("A2").Select
Selection.End(xlDown).Select
Range("E26320").Select
Range(Selection, Selection.End(xlUp)).Select
ActiveSheet.Paste
Selection.End(xlUp).Select
Range("E2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Columns("A:A").Select
Range("A26285").Activate
Selection.End(xlUp).Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("F1").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "1"
Range("F1").Select
Selection.Copy
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("B2:C2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.NumberFormat = "$#,##0"
Range("B4").Select
Sheets("Forecast Update").Select
ActiveWindow.SelectedSheets.Visible = False
End Sub
Sub Fcst_Update()


End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
It may depend on which sheet you are on when you start your Macro.
One simple workaround it to try to add in explicit sheet references, or activating/selecting the sheets.
Note that making a sheet visible does NOT actually activate/select that sheet!

So maybe something as simple as this will fix your issue:
Code:
[COLOR=#333333]Sheets("Forecast Update").Visible = True
[/COLOR][COLOR=#ff0000]Sheets("Forecast Update").Activate[/COLOR][COLOR=#333333]
[/COLOR]
 
Last edited:
Upvote 0
Thank you for your help, it did fix the issue, i was under the impression that when you made it visible it activated it.
 
Upvote 0

Forum statistics

Threads
1,216,108
Messages
6,128,872
Members
449,475
Latest member
Parik11

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