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

Hello fellow excel users...

I have a question on using vba to extract data from an array. Okay,
here's the scenario...

A B C
1 Task Deliver drawings 6/20/2007
2 General Note Did some things
3 General Note Finished some things
4 Task Order new drawings 6/21/2007
5 Task Finish drawings 6/22/2007
6 Phone Call Talked with Bill
7 Task Finish project 6/25/2007

A1:A7 are strings (obviously), as are B1:B7. There will not be any
dates in the rows that are NOT titled "Task". What I want to do is
have VBA extract the rows titled "Task" (including their subject and
date) and put them in a new column. Or something to that effect so
that when the code is run, what will be left is this...

Task Deliver drawings 6/20/2007
Task Order new drawings 6/21/2007
Taks Finish drawings 6/22/2007
Taks Finish project 6/25/2007

If it's possible, the rows with General Note and Phone Call can be
eliminated so that only rows with Task are left is fine. I didn't
know if sorting a new list or just eliminating rows would be easier.
Anyway, this is what I need and I don't know how to do that. Can
anyone help? Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default extracting data in an array

Do you want VBA code?

Sub Eliminaterows()
Dim lastrow as Long, i as Long
lastrow = cells(rows.count,3).end(xlup).row
for i = lastrow to 1 step -1
if lcase(cells(i,1)) < "task" or cells(i,3)="" then
rows(i).EntireRow.delete
end if
next
EndSub

Test this on a copy of your data to make sure it works.

--
Regards,
Tom Ogilvy


" wrote:

Hello fellow excel users...

I have a question on using vba to extract data from an array. Okay,
here's the scenario...

A B C
1 Task Deliver drawings 6/20/2007
2 General Note Did some things
3 General Note Finished some things
4 Task Order new drawings 6/21/2007
5 Task Finish drawings 6/22/2007
6 Phone Call Talked with Bill
7 Task Finish project 6/25/2007

A1:A7 are strings (obviously), as are B1:B7. There will not be any
dates in the rows that are NOT titled "Task". What I want to do is
have VBA extract the rows titled "Task" (including their subject and
date) and put them in a new column. Or something to that effect so
that when the code is run, what will be left is this...

Task Deliver drawings 6/20/2007
Task Order new drawings 6/21/2007
Taks Finish drawings 6/22/2007
Taks Finish project 6/25/2007

If it's possible, the rows with General Note and Phone Call can be
eliminated so that only rows with Task are left is fine. I didn't
know if sorting a new list or just eliminating rows would be easier.
Anyway, this is what I need and I don't know how to do that. Can
anyone help? Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default extracting data in an array

This deleted all of the rows.



On Jun 18, 8:43 am, Tom Ogilvy
wrote:
Do you want VBA code?

Sub Eliminaterows()
Dim lastrow as Long, i as Long
lastrow = cells(rows.count,3).end(xlup).row
for i = lastrow to 1 step -1
if lcase(cells(i,1)) < "task" or cells(i,3)="" then
rows(i).EntireRow.delete
end if
next
EndSub

Test this on a copy of your data to make sure it works.

--
Regards,
Tom Ogilvy


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default extracting data in an array

Wait! My bad!! It actually DID work!

At first there was an error in what you gave me. I thought it was
because you had "task" and not "Task". So I made it upper case. But
then I noticed you didn't have a space between EndSub. But I didn't
change Task back to task and later I noticed that you made everything
lowercase with LCase. It works perfect. This is EXACTLY what I
wanted. THANKS!!!!

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 a list from an array PT[_3_] Excel Worksheet Functions 1 March 1st 10 04:40 AM
Extracting Specific dimensions/values from multidimensional array [email protected] Excel Programming 5 May 2nd 07 04:42 AM
Extracting sub arrays from a 2-D VBA array Alan Beban[_2_] Excel Programming 7 August 16th 04 09:50 PM
extracting a subset of an array with VBA. y Excel Programming 3 April 19th 04 10:35 AM
extracting a subset of an array with VBA. y Excel Programming 4 April 19th 04 07:45 AM


All times are GMT +1. The time now is 09:06 PM.

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"