I am using Excel 2016. The code fails in a VBA Macro I am trying to develop. The Macro was developed with Record Macro, then changed a little.
My object is to use a cell "U2" to find a row in a table by filtering using the cell data. That works, I can see the results hovering over the "U2" .Value.
Using the results to copy the two row cell data is coded as:
However, when hovering over the Range, nothing is copied. I don't want those cells as they are from a previous selection and were hard coded into the Macro. Is there a way to go to a row and select 2 cells in that row?
The range was obtained as I manually filtered while recording the Macro, then selected and copied the two cells and that worked. I was able to manually paste the cells to another 2 cells on the sheet while I recorded, but not with VBA. I don't know how to go to the same row as the "U2" data and copy the row cell data using VBA.
My object is to use a cell "U2" to find a row in a table by filtering using the cell data. That works, I can see the results hovering over the "U2" .Value.
Code:
Range("U2").Select Selection.Copy
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:=Range("U2").Value
Using the results to copy the two row cell data is coded as:
Code:
Range("I214:J214").Select
Application.CutCopyMode = False
Selection.Copy
However, when hovering over the Range, nothing is copied. I don't want those cells as they are from a previous selection and were hard coded into the Macro. Is there a way to go to a row and select 2 cells in that row?
The range was obtained as I manually filtered while recording the Macro, then selected and copied the two cells and that worked. I was able to manually paste the cells to another 2 cells on the sheet while I recorded, but not with VBA. I don't know how to go to the same row as the "U2" data and copy the row cell data using VBA.
Last edited: