PC Review


Reply
Thread Tools Rate Thread

Auto Copy based on criteria in colum

 
 
J.W. Aldridge
Guest
Posts: n/a
 
      5th Sep 2007
Hi,

I have a column of formulated data (results from looking up on another
sheet) in column B.
Based on the date value anyone puts in cell a1 this sheet...

I need a macro that would copy the results in row B, and paste values
in C.

(ex. If someone puts 9/2 in cell a1, the macro would find that date
value and copy the cells in column B based on matching that criteria
and paste in C.).

Cell A1= date

A B C
results from formula values copied
9/2 123 123
9/2 456 456
9/2 789 789
9/2 012 012
9/3 123
9/3 456
9/3 789
9/3 012

If there are any easier ideas, please let me know. thanx.
Thanx

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UHJhbmF2IFZhaWR5YQ==?=
Guest
Posts: n/a
 
      5th Sep 2007
Hi,

I think you don't need a macro to do this. What you can do is write a
VLOOKUP() in col B and make col C as '=B1' and so on.

By doing this the values will be automatically fetched in both the columns.

HTH,
--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"J.W. Aldridge" wrote:

> Hi,
>
> I have a column of formulated data (results from looking up on another
> sheet) in column B.
> Based on the date value anyone puts in cell a1 this sheet...
>
> I need a macro that would copy the results in row B, and paste values
> in C.
>
> (ex. If someone puts 9/2 in cell a1, the macro would find that date
> value and copy the cells in column B based on matching that criteria
> and paste in C.).
>
> Cell A1= date
>
> A B C
> results from formula values copied
> 9/2 123 123
> 9/2 456 456
> 9/2 789 789
> 9/2 012 012
> 9/3 123
> 9/3 456
> 9/3 789
> 9/3 012
>
> If there are any easier ideas, please let me know. thanx.
> Thanx
>
>

 
Reply With Quote
 
J.W. Aldridge
Guest
Posts: n/a
 
      5th Sep 2007
Thanx.
That would work, however, the sheet from which column B is pulling its
data is subject to change. That's why i need to copy and paste values.
If leave a = formula in C, then when criteria for which the data in B
is no longer avaialbe, it will all dissappear.

I found the following code which bases it on two conditions, i only
need one. (which would be in cell A1). Please advise if i can alter
this code to refer to one condition/cell (A1).


Sub macro1()
Dim ws As Worksheet
Dim iA As Integer
Dim iB As Integer
Dim c As Range
Dim rng As Range


Set ws = Worksheets("Sheet1")
Set rng = ws.Range("C2:C16")
For Each c In rng
If c = "A" Then
iA = iA + 1
ws.Cells(iA, 5) = c.Offset(0, -2)
ws.Cells(iA, 6) = c.Offset(0, -1)
Else
iB = iB + 1
ws.Cells(iB, 8) = c.Offset(0, -2)
ws.Cells(iB, 9) = c.Offset(0, -1)
End If
Next c
End Sub

 
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
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Microsoft Excel Programming 4 5th Oct 2007 04:00 PM
sum certain cells in a column based on criteria from another colum =?Utf-8?B?cmFpbmJvd3JhdmVu?= Microsoft Excel Worksheet Functions 8 13th Apr 2007 02:05 AM
Re: Count Unique records based on the Criteria in another colum Herbert Seidenberg Microsoft Excel Worksheet Functions 0 1st Dec 2006 12:46 AM
Based on criteria in 1 colum, return data from a different colum. =?Utf-8?B?ZGNvenpp?= Microsoft Access 5 17th Mar 2006 03:19 PM
Locate max value of one column based on criteria in another colum =?Utf-8?B?SkRheTAx?= Microsoft Excel Worksheet Functions 2 1st Sep 2005 06:47 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:08 PM.