Search across rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What would be the best way to accomplish this task?
Search across rows to the last value in that row, copy that value and paste
it into a different sheet.
I have multiple rows that I need to do this with, but they are non-contiguous.

Thanks in advance!
 
First you need to get the last row using the end statnment. rows.Count is an
excel constant which is set to 65364 and xlup seaches from the last row until
it find the first cell with data.

Then do the same thing with columns

LastRow = cells(rows.Count,"A").end(xlup).Row
set ColAdata = range(cells(1,"A"),cells(Lastrow,"A"))

for each cell in ColAdata

LastCol = cells(cell.row,Columns.Count).end(xltoleft).Column
copydata = cells(cell.row,LastCol)
' enter your real code below.
sheets("Newsheet").range("A5") = copydata

next cell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top