Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default data records in a table extracting

i have a table with many records in it. the second sheet
is for records that have been removed from the table
because they are no longer active. lets just say that i
put an "X" in column J to denote the record needing to be
removed. i need a macro that can look for the "X" and
select column A:J for that row, pull it out of the table,
and paste it to the bottom of a similar table on sheet 2
that shows the old records. i need it on the bottom
because they are to be in chronological order.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default data records in a table extracting

Spence,

Sub testit()
Dim i As Long, lngFirstRow As Long, lngLastRow As Long
Dim rng As Range, rngDest As Range

With Sheet1
lngFirstRow = .Cells(1, 10).End(xlDown).Row
lngLastRow = .Cells(Rows.Count, 10).End(xlUp).Row
For i = lngFirstRow To lngLastRow
If UCase(.Cells(i, 10)) = "X" Then
If rng Is Nothing Then
Set rng = Range(.Cells(i, 1), .Cells(i, 10))
Else
Set rng = Union(rng, Range(.Cells(i, 1), .Cells(i, 10)))
End If
End If
Next
End With

If Not rng Is Nothing Then
Set rngDest = Sheet2.Cells(Rows.Count, 1).End(xlUp)
If Not IsEmpty(rngDest) Then Set rngDest = rngDest.Offset(1, 0)
rng.Copy rngDest
rng.Delete xlUp
End If
End Sub

Rob


"spence" wrote in message
...
i have a table with many records in it. the second sheet
is for records that have been removed from the table
because they are no longer active. lets just say that i
put an "X" in column J to denote the record needing to be
removed. i need a macro that can look for the "X" and
select column A:J for that row, pull it out of the table,
and paste it to the bottom of a similar table on sheet 2
that shows the old records. i need it on the bottom
because they are to be in chronological order.



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
Extracting Data from Table Alisa Ganz Excel Discussion (Misc queries) 0 March 23rd 10 01:39 PM
Extracting Table Data maria Excel Worksheet Functions 1 May 22nd 09 06:37 PM
extracting data from a table mitch Excel Discussion (Misc queries) 3 January 25th 08 10:43 PM
Extracting Data from a Table Iceman Excel Discussion (Misc queries) 6 November 29th 07 04:13 PM
Extracting Data From A Table zephyr Excel Discussion (Misc queries) 2 December 22nd 06 02:45 AM


All times are GMT +1. The time now is 08:09 AM.

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

About Us

"It's about Microsoft Excel"