ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Search across rows (https://www.excelbanter.com/excel-programming/395538-search-across-rows.html)

tom

Search across rows
 
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!

joel

Search across rows
 
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

"Tom" wrote:

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!



All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com