Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Slection of Rows on a Condition

I am analyzing performance of Projects, which are around 30000 rows of
information and 160 Columns of information. This is contained in a Worksheet
named Projects-06

I want to achieve the following in a blank worksheet in the same workbook,
by culling out information from the Worksheet Projects-06, selective 4
columns of information, depending on 2 conditions. (Cost<0 and Status=€Y€)

Col-A €“ Project-ID
Col-B- Project-Name
Col-C- Cost
Col-D- Status

I am a advanced foxpro programmer /excel user but a VB Novice.
I want to achieve this using a VB macro.

Any help will be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Slection of Rows on a Condition

hi Ananth try this.

Sub Achieve()

Sheets("Projects-06").Activate
Dim r, rw, t
r = Range("A65500").End(xlUp).Row
rw = 1
For t = 2 To r
If Cells(t, 3) 0 And Cells(t, 4) = "Y" Then
rw = rw + 1
Sheets("Blank").Cells(rw, 1) = Cells(t, 1)
Sheets("Blank").Cells(rw, 2) = Cells(t, 2)
Sheets("Blank").Cells(rw, 3) = Cells(t, 3)
Sheets("Blank").Cells(rw, 4) = Cells(t, 4)
End If
Next

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Slection of Rows on a Condition



"excelent" skrev:

hi Ananth try this.

Sub Achieve()

Sheets("Projects-06").Activate
Dim r, rw, t
r = Range("A65500").End(xlUp).Row
rw = 1
For t = 2 To r
If Cells(t, 3) 0 And Cells(t, 4) = "Y" Then
rw = rw + 1
Sheets("Blank").Cells(rw, 1) = Cells(t, 1)
Sheets("Blank").Cells(rw, 2) = Cells(t, 2)
Sheets("Blank").Cells(rw, 3) = Cells(t, 3)
Sheets("Blank").Cells(rw, 4) = Cells(t, 4)
End If
Next

End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Slection of Rows on a Condition

change
If Cells(t, 3) 0 And Cells(t, 4) = "Y" Then
to
If Cells(t, 3) < 0 And Cells(t, 4) = "Y" Then

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Slection of Rows on a Condition

Thanks very much; It worked.
Is it possible to retain the formating properties; For example, I have
colored a row in Green,. I would like to contine see that row in green in the
"Blank" worksheet also

"excelent" wrote:

change
If Cells(t, 3) 0 And Cells(t, 4) = "Y" Then
to
If Cells(t, 3) < 0 And Cells(t, 4) = "Y" Then



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Slection of Rows on a Condition

try this one (changed a bit to speed up courses the color check)

Sub AchieveCol()

Sheets("Projects-06").Activate
Dim r, rw, t
r = Range("A65500").End(xlUp).Row
rw = 1
For t = 2 To r
If Cells(t, 3) < 0 And Cells(t, 4) = "Y" Then
rw = rw + 1
Range("A" & t & ":D" & t).Copy Destination:=Sheets("Blank").Range("A" & rw &
":D" & rw)
End If
Next

End Sub


"Ananth" skrev:

Thanks very much; It worked.
Is it possible to retain the formating properties; For example, I have
colored a row in Green,. I would like to contine see that row in green in the
"Blank" worksheet also

"excelent" wrote:

change
If Cells(t, 3) 0 And Cells(t, 4) = "Y" Then
to
If Cells(t, 3) < 0 And Cells(t, 4) = "Y" Then

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
Debit/credit amount Slection How? Qazi Ahmad Excel Discussion (Misc queries) 1 January 11th 07 06:07 AM
Force condition on all Rows afmullane Excel Programming 1 April 17th 06 08:29 PM
In VBA set Slection.AutoFilter show all Djmask Excel Programming 4 August 18th 05 06:10 PM
*difficult* importing slection from a txt file to new column Trogent Excel Programming 2 July 19th 05 04:22 AM
delete rows with certain condition Grey Excel Programming 2 December 19th 03 12:05 PM


All times are GMT +1. The time now is 10:20 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"