Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 15
Default Copy cell value to new worksheet, based on find results

I have a spreadsheet with a few columns. Sheet 1, Column A contains
numbers. Sheet 2, Column A contains the same numbers, just in different
order. I want to be able to say something like - if value in A5 = 32,
copy value the value in D5 and paste it into Sheet 2 where the value in
column A is 32. I want Sheet 2 to have only the values of column A and
Column D.

Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy cell value to new worksheet, based on find results


Dan,

not sure if you specifically want to use VBA to do this...but you ca
use a formula.

Assume that in Sheet 1 column A you have a range of numbers and Sheet
column D you have a range of numbers. If I understand, based on th
value in a cell in column A, you want to copy the value in column D o
that same row, to sheet 2 and place on (in column D ??) on the same ro
as the cell in sheet 2 column A having the same number as sheet1 colum
A.

kind of wordy...but right?

you can use this formula:

=SUMPRODUCT(--(EXACT(Sheet1!$A$1:$A$30,$A1)),Sheet1!$D$1:$D$30)

if sheet 1 cols A and D are populated..and column A sheet 2 i
populated, then all you need to do is copy this formula into col D o
sheet 2 and copy down.

you may need to adjust the searched range (ie. $A$1:$A$30 and $D1:$D30
to fit your data.

this worked fine for me when I tested it, however on a side note if
cell in sheet 2 col A matches more than one cell in sheet 1 col A, thi
formula will sum those two numbers together and place them in sheet
col D.

HT

--
Cel
-----------------------------------------------------------------------
Celt's Profile: http://www.excelforum.com/member.php...fo&userid=1941
View this thread: http://www.excelforum.com/showthread.php?threadid=55332

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Copy cell value to new worksheet, based on find results

Dan
This macro will do that. Note that Sheet1 has to be the active sheet
and your Sheet2 is named "Two" in this macro. Change that to suit your
actual data.
HTH Otto
Sub CopyNums()
Dim OneColA As Range 'Column A in Sheet1
Dim TwoColA As Range 'Column A in sheet "Two"
Dim i As Range
Set OneColA = Range("A1", Range("A" & Rows.Count).End(xlUp))
With Sheets("Two")
Set TwoColA = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
For Each i In OneColA
If Not TwoColA.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
Then _
TwoColA.Find(What:=i.Value, LookAt:=xlWhole).Offset(, 1) = _
i.Offset(, 3).Value
Next i
End With
End Sub
"dan" wrote in message
ups.com...
I have a spreadsheet with a few columns. Sheet 1, Column A contains
numbers. Sheet 2, Column A contains the same numbers, just in different
order. I want to be able to say something like - if value in A5 = 32,
copy value the value in D5 and paste it into Sheet 2 where the value in
column A is 32. I want Sheet 2 to have only the values of column A and
Column D.

Thanks in advance!



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
copy active cell value,find the pasted value in different worksheet [email protected] Excel Worksheet Functions 2 July 9th 06 09:56 AM
Paste results consecutively within column (based off other worksheet) [email protected] Excel Worksheet Functions 5 March 13th 06 11:54 AM
copy and paste cells to a different worksheet according to IF results faze Excel Programming 1 February 1st 06 02:41 PM
Need to find a row in a worksheet based on the value of a cell Ginger Excel Worksheet Functions 1 September 6th 05 10:43 PM
How to generate a file copy of the Excel Find results list MrSpreadsheet Excel Programming 4 February 11th 05 07:07 AM


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