PC Review


Reply
Thread Tools Rate Thread

Copying data based on certain criteria

 
 
haas786@yahoo.com
Guest
Posts: n/a
 
      9th Apr 2007
Hi all!

I have a question that I believe you guys can answer. Here it is:

I have 2 tabs in an Excel workbook - one tab ('All Transactions')
contains info for every type of transaction I've done. This gets
continuously updated from other spreadsheets via a macro. There is a
column (Column B) within this tab which describes what type of
transaction it is ("Bound", "Declined", "ANB"). What I want done is to
run a macro which would copy the first 15 columns from this tab with
the any transaction which is labeled as "Bound" in column B and paste
it to the 2nd tab in the workbook ('Bound Transactions'). In essence,
I don't want to copy any deals labeled as "Declined" or "ANB" from
column B. I hope I wasn't too confusing - can someone please help?

Thanks!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?V2lsbGlhbSBIb3J0b24=?=
Guest
Posts: n/a
 
      9th Apr 2007
Try this procedure.

Sub CopyData()
Dim C As Long, ATS As Worksheet, BTS As Worksheet
Set ATS = ThisWorkbook.Worksheets("All Transactions")
Set BTS = ThisWorkbook.Worksheets("Bound Transactions")
For C = 1 To ATS.Cells(ATS.Rows.Count, 2).End(xlUp).Row
If ATS.Cells(C, 2).Value = "Bound" Then
ATS.Range(ATS.Cells(C, 1), ATS.Cells(C, 15)).Copy
Destination:=BTS.Cells((Application.WorksheetFunction.CountA(BTS.Columns(2)))
+ 1, 1)
End If
Next C
End Sub

Hope this helps.

If you don't want a macro or want to adjust the macro a little try playing
around with the advanced filter functionality.

Bill Horton

"(E-Mail Removed)" wrote:

> Hi all!
>
> I have a question that I believe you guys can answer. Here it is:
>
> I have 2 tabs in an Excel workbook - one tab ('All Transactions')
> contains info for every type of transaction I've done. This gets
> continuously updated from other spreadsheets via a macro. There is a
> column (Column B) within this tab which describes what type of
> transaction it is ("Bound", "Declined", "ANB"). What I want done is to
> run a macro which would copy the first 15 columns from this tab with
> the any transaction which is labeled as "Bound" in column B and paste
> it to the 2nd tab in the workbook ('Bound Transactions'). In essence,
> I don't want to copy any deals labeled as "Declined" or "ANB" from
> column B. I hope I wasn't too confusing - can someone please help?
>
> Thanks!
>
>

 
Reply With Quote
 
merjet
Guest
Posts: n/a
 
      9th Apr 2007
Sub CopyBound()
Dim iR1 As Integer
Dim iR2 As Integer
Dim ws1 As Worksheet
Dim ws2 As Worksheet

Set ws1 = Sheets("All Transactions")
Set ws2 = Sheets("Bound Transactions")
ws2.Cells.Clear
Do
iR1 = iR1 + 1
If ws1.Range("B" & iR1) = "Bound" Then
iR2 = iR2 + 1
ws1.Range("A" & iR1 & ":O" & iR1).Copy _
ws2.Range("A" & iR2)
End If
Loop Until ws1.Range("A" & iR1) = ""
End Sub

Hth,
Merjet


 
Reply With Quote
 
merjet
Guest
Posts: n/a
 
      9th Apr 2007
You could also filter the data on Bound and copy the filtered data.

Hth,Merjet


 
Reply With Quote
 
haas786@yahoo.com
Guest
Posts: n/a
 
      10th Apr 2007
On Apr 9, 3:03 pm, "merjet" <mer...@comcast.net> wrote:
> You could also filter the data on Bound and copy the filtered data.
>
> Hth,Merjet


Merjet...thanks for your help - the earlier programming code helped! I
have a new problem similar to this one and am re-posting it. I
appreciate all your help! Thanks..

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying from one TAB to another based on certain criteria Thomas Microsoft Excel New Users 1 14th Feb 2009 01:34 AM
copying data from one worksheet to several based on criteria marcia2026 Microsoft Excel Programming 1 31st Jul 2008 03:38 AM
Copying a Row in a sheet based on criteria in another nab Microsoft Excel Programming 1 12th Jun 2008 07:56 AM
Copying data based on filter criteria no_rhythm Microsoft Excel Worksheet Functions 1 10th Jan 2008 09:45 PM
Copying data from one worksheet to another based on criteria Caatt Microsoft Excel Misc 1 15th Jun 2006 10:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:50 AM.