LuizRenanFB
New Member
- Joined
- Jun 13, 2022
- Messages
- 1
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
- Mobile
Hi!
I would like some help,
I'm trying to create a spreadsheet for moving items using macro in a table that has filters.
I'm trying to use the macro to move products, "FROM" the initial position that the object is in (Cell C3), to "FOR" the final position that the object will be (Cell C5).
I had written a code but the line in the cell where the macro was recorded remains fixed, and not in the position/line that the filter selects resumes.
How can I solve this problem? Or is there a finer solution to accomplish this process?
______
Sub TESTMOVE()
'
' Macro1 Macro
'
'
Range("C3").Select
Selection.Copy
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5, Criteria1:=Range("C3").Value
Range("H11:K11").Select
Application.CutCopyMode = False
Selection.Copy
Range("H4").Select
ActiveSheet.Paste
Range("H11:K11").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C5").Select
Selection.Copy
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5, Criteria1:=Range("C5").Value
Range("H4:K4").Select
Application.CutCopyMode = False
Selection.Copy
Range("H12").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5
End Sub
I would like some help,
I'm trying to create a spreadsheet for moving items using macro in a table that has filters.
I'm trying to use the macro to move products, "FROM" the initial position that the object is in (Cell C3), to "FOR" the final position that the object will be (Cell C5).
I had written a code but the line in the cell where the macro was recorded remains fixed, and not in the position/line that the filter selects resumes.
How can I solve this problem? Or is there a finer solution to accomplish this process?
______
Sub TESTMOVE()
'
' Macro1 Macro
'
'
Range("C3").Select
Selection.Copy
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5, Criteria1:=Range("C3").Value
Range("H11:K11").Select
Application.CutCopyMode = False
Selection.Copy
Range("H4").Select
ActiveSheet.Paste
Range("H11:K11").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("C5").Select
Selection.Copy
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5, Criteria1:=Range("C5").Value
Range("H4:K4").Select
Application.CutCopyMode = False
Selection.Copy
Range("H12").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.ListObjects("Tabela423").Range.AutoFilter Field:=5
End Sub