Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
tom tom is offline
external usenet poster
 
Posts: 570
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to search for grouped rows? Minerva Excel Worksheet Functions 1 June 27th 06 06:18 AM
Search and Replace Rows MaddMax Excel Programming 1 March 14th 06 04:49 PM
Search Columns & Rows mully Excel Discussion (Misc queries) 1 February 3rd 06 11:38 AM
search rows jt46[_6_] Excel Programming 1 October 16th 04 09:07 PM
Search Rows in a spreadsheet QandA[_2_] Excel Programming 4 June 21st 04 06:02 PM


All times are GMT +1. The time now is 11:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"