ruzanovsky
New Member
- Joined
- Jul 12, 2018
- Messages
- 6
Dears,
I want to change the range that the macro pulls automatically, as below:
How do I apply this?
Regards
I want to change the range that the macro pulls automatically, as below:
Code:
[I]Sub Weekly()
'
' Weekly Macro
'
'
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Windows("weekly.csv").Activate
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Columns("G:G").Select
Selection.Cut
Columns("F:F").Select
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Selection.Insert Shift:=xlToRight
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="/", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _
TrailingMinusNumbers:=True
Columns("E:G").Select
Selection.Delete Shift:=xlToLeft
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlUp
Columns("D:D").Select
Selection.Insert Shift:=xlToRight
Range("D1").Select
ActiveCell.FormulaR1C1 = "=IF(RC[2]<=100000,1,2)"
Range("D1").Select
[COLOR=#ff0000][B] Selection.AutoFill Destination:=Range("D1:D307") ##Here, I want it to select from D1 to last row, not D307[/B][/COLOR]
[COLOR=#ff0000][B] Range("D1:D307").Select[/B][/COLOR]
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Delete Shift:=xlUp
[COLOR=#ff0000][B] Range("A1:H306").Select [B]##Here, I want it to select from A1 to last row, not H306[/B][/B][/COLOR]
[COLOR=#ff0000][B] Range("A306").Activate[/B][/COLOR]
Selection.Copy
Windows("Faturamento_Julho EM10.xlsm").Activate
Range("A2").Select
ActiveSheet.Paste
Sheets("DIN WEEKLY").Select
Range("C12").Select
Application.CutCopyMode = False
ActiveSheet.PivotTables("Tabela dinâmica1").PivotCache.Refresh
Range("C10:F10").Select
Selection.Copy
[COLOR=#ff0000][B] Range("C11:F187").Select ## Here, I want to select from C11 to last row, not F187[/B][/COLOR]
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A8").Select
Sheets("PLANO DE OV").Select
Range("A1").Select
End Sub[/I]
How do I apply this?
Regards
Last edited by a moderator: