Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default If Statement..i think

Hi

I'm wondering if anyone can help me..

I have a worksheet with a drop down list in column H2:H100 that has two
options; Complete or Pending.

I want to write some sort of macro to say if pending, then leave the row on
the sheet (rows a1:g1). But if 'Complete' is selected then cut the row and
paste it in the 'History' worksheet.

Is this possible?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default If Statement..i think

Drop down?

"zak" wrote:

Hi

I'm wondering if anyone can help me..

I have a worksheet with a drop down list in column H2:H100 that has two
options; Complete or Pending.

I want to write some sort of macro to say if pending, then leave the row on
the sheet (rows a1:g1). But if 'Complete' is selected then cut the row and
paste it in the 'History' worksheet.

Is this possible?

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default If Statement..i think

Yes a drop down list with two options; Complete or Pending..as in the one you
can create via Data - Data Validation - Allow: List

"JLGWhiz" wrote:

Drop down?

"zak" wrote:

Hi

I'm wondering if anyone can help me..

I have a worksheet with a drop down list in column H2:H100 that has two
options; Complete or Pending.

I want to write some sort of macro to say if pending, then leave the row on
the sheet (rows a1:g1). But if 'Complete' is selected then cut the row and
paste it in the 'History' worksheet.

Is this possible?

Thank you

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default If Statement..i think

Hi,
You can use this...

Sub Macro()
'Sheet3 .....all data..
'Sheet2......contains filtered data
Dim i, j, n As Integer
j = 1
Sheet3.Activate
For i = 1 To Sheet3.UsedRange.Rows.Count
If (Cells(i, 8) = "Complete") Then
For n = 1 To Sheet3.UsedRange.Columns.Count
Sheet2.Cells(j, n) = Sheet3.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub


zak wrote:
Yes a drop down list with two options; Complete or Pending..as in the one you
can create via Data - Data Validation - Allow: List

Drop down?

[quoted text clipped - 12 lines]

Thank you


  #5   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default If Statement..i think

Hello

This is great, the code you have given me works!! I was wondering if you
can help me add 2 more things to it:

1) How can i get the row in sheet one to get deleted once it has been copied
over to sheet 7?

1) In sheet 7, id like row 1 to have a heading, so rows copied over from
sheet 1, should then go into row 2 onwards?

Here is the code which I have:

Sub Macro()
'Sheet1 .....all data..
'Sheet7......contains filtered data
Dim i, j, n As Integer
j = 1
Sheet1.Activate
For i = 1 To Sheet1.UsedRange.Rows.Count
If (Cells(i, 8) = "Complete") Then
For n = 1 To Sheet1.UsedRange.Columns.Count
Sheet7.Cells(j, n) = Sheet1.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub

Thanks for your help.

"aamerrasheed" wrote:

Hi,
You can use this...

Sub Macro()
'Sheet3 .....all data..
'Sheet2......contains filtered data
Dim i, j, n As Integer
j = 1
Sheet3.Activate
For i = 1 To Sheet3.UsedRange.Rows.Count
If (Cells(i, 8) = "Complete") Then
For n = 1 To Sheet3.UsedRange.Columns.Count
Sheet2.Cells(j, n) = Sheet3.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub


zak wrote:
Yes a drop down list with two options; Complete or Pending..as in the one you
can create via Data - Data Validation - Allow: List

Drop down?

[quoted text clipped - 12 lines]

Thank you





  #6   Report Post  
Posted to microsoft.public.excel.programming
Zak Zak is offline
external usenet poster
 
Posts: 144
Default If Statement..i think

Hello

I don't think I have had a response to my question to, so I'd like to kindly
ask you again.

I have used your code which works great, but id like to take it a little bit
further and was wondering if you can help me?

I want to:

1) How can i get the row in sheet one to get deleted once it has been copied
over to sheet 7?

2) Any new rows that are populated in the sheet 1, id like for it to be
added to a new row in sheet 7, an not over write the rows already in sheet 7.

Please let me know if you can help me with either of my queries.

Thanking you in advance.

Here is the code which I have:

Sub Macro()
'Sheet1 .....all data..
'Sheet7......contains filtered data
Dim i, j, n As Integer
j = 1
Sheet1.Activate
For i = 1 To Sheet1.UsedRange.Rows.Count
If (Cells(i, 8) = "Complete") Then
For n = 1 To Sheet1.UsedRange.Columns.Count
Sheet7.Cells(j, n) = Sheet1.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub






"aamerrasheed" wrote:

Hi,
You can use this...

Sub Macro()
'Sheet3 .....all data..
'Sheet2......contains filtered data
Dim i, j, n As Integer
j = 1
Sheet3.Activate
For i = 1 To Sheet3.UsedRange.Rows.Count
If (Cells(i, 8) = "Complete") Then
For n = 1 To Sheet3.UsedRange.Columns.Count
Sheet2.Cells(j, n) = Sheet3.Cells(i, n)
Next n
j = j + 1
End If
Next i
End Sub


zak wrote:
Yes a drop down list with two options; Complete or Pending..as in the one you
can create via Data - Data Validation - Allow: List

Drop down?

[quoted text clipped - 12 lines]

Thank you



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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Embedding an OR statement in an IF statement efficiently Chatnoir11 Excel Discussion (Misc queries) 4 February 2nd 09 08:12 PM
appending and IF statement to an existing IF statement spence Excel Worksheet Functions 1 February 28th 06 11:00 PM
If statement and Isblank statement Rodney C. Excel Worksheet Functions 0 January 18th 05 08:39 PM


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