Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default I want to copy one cell value from sheet 1 to sheet 2 conditionall

Hi I have a couple of worksheets that are making me crazy, and I will
appreciate any idea you can give me: The first worksheet looks as follows:

WKS1:
cust name postcode custnumber
AB me1 4qq 12345
Abc me4 6nu 12346
abcd me3 8fg 12347
abcde me4 1ff 12348

And another that looks as follows:

WKS2
custname postcode custnumber
Abc me4 6nu
AB me1 4qq
abcd me3 8fg
abcde me4 1ff


As you can see:

1) The values in column custname are the same BUT they are NOT in the same
order.

2) The custnumber is empty in WKS2.

So what I want to do is:

from WKS2 pickup the values from custname (one by one) and compare them to
the same column in WKS1, if the value match then vaildate if the value in
column postcode from WKS1 (is WKS1 no misstake here) is the same as postcode
in WKS2. If so copy the value from the correspondent custnumber from WKS1 to
WKS2.

That is the must have if possible.

The nice to have will be to also copy the cell format from WKS1 to WKS2, as
some custnumber values are in red, while others are in black.

THANK YOU for any idea you can share.

Rob.


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default I want to copy one cell value from sheet 1 to sheet 2 conditionall

Sub copynumstoothersht()
Sheets("wks1").Select
For i = 2 To Cells(Rows.Count, "a").End(xlUp).Row
With Sheets("wks2")
mr = .Cells.Find(What:=Cells(i, "a"), After:=.Cells(1, 1), _
LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Row
Cells(i, 4).Copy
..Cells(mr, 4).PasteSpecial Paste:=xlPasteAllExceptBorders
Application.CutCopyMode = False
End With
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"RobertoB" wrote in message
...
Hi I have a couple of worksheets that are making me crazy, and I will
appreciate any idea you can give me: The first worksheet looks as follows:

WKS1:
cust name postcode custnumber
AB me1 4qq 12345
Abc me4 6nu 12346
abcd me3 8fg 12347
abcde me4 1ff 12348

And another that looks as follows:

WKS2
custname postcode custnumber
Abc me4 6nu
AB me1 4qq
abcd me3 8fg
abcde me4 1ff


As you can see:

1) The values in column custname are the same BUT they are NOT in the
same
order.

2) The custnumber is empty in WKS2.

So what I want to do is:

from WKS2 pickup the values from custname (one by one) and compare them to
the same column in WKS1, if the value match then vaildate if the value in
column postcode from WKS1 (is WKS1 no misstake here) is the same as
postcode
in WKS2. If so copy the value from the correspondent custnumber from WKS1
to
WKS2.

That is the must have if possible.

The nice to have will be to also copy the cell format from WKS1 to WKS2,
as
some custnumber values are in red, while others are in black.

THANK YOU for any idea you can share.

Rob.



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,344
Default I want to copy one cell value from sheet 1 to sheet 2 conditionall

Hi,

Here is a formula approach:

Assume your data start in cell A1 of Sheet1 and Sheet2 so you want to copy
the customer number from sheet1 to sheet2 if the name and post code match:
In cell C2, under the title, array enter the following formula:

=IF(ISNA(MATCH(A2&B2,Sheet1!A$2:A$5&Sheet1!B$2:B$5 ,0)),"",OFFSET(Sheet1!C$1,MATCH(A2&B2,Sheet1!A$2:A $5&Sheet1!B$2:B$5,0),0))

To enter this as an array press Shift+Ctrl+Enter not Enter.

copy the formula down as far as necessary.
--
Thanks,
Shane Devenshire


"RobertoB" wrote:

Hi I have a couple of worksheets that are making me crazy, and I will
appreciate any idea you can give me: The first worksheet looks as follows:

WKS1:
cust name postcode custnumber
AB me1 4qq 12345
Abc me4 6nu 12346
abcd me3 8fg 12347
abcde me4 1ff 12348

And another that looks as follows:

WKS2
custname postcode custnumber
Abc me4 6nu
AB me1 4qq
abcd me3 8fg
abcde me4 1ff


As you can see:

1) The values in column custname are the same BUT they are NOT in the same
order.

2) The custnumber is empty in WKS2.

So what I want to do is:

from WKS2 pickup the values from custname (one by one) and compare them to
the same column in WKS1, if the value match then vaildate if the value in
column postcode from WKS1 (is WKS1 no misstake here) is the same as postcode
in WKS2. If so copy the value from the correspondent custnumber from WKS1 to
WKS2.

That is the must have if possible.

The nice to have will be to also copy the cell format from WKS1 to WKS2, as
some custnumber values are in red, while others are in black.

THANK YOU for any idea you can share.

Rob.


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 data of two cells from Sheet 2 into one cell in Sheet 1 cahabbinga Excel Worksheet Functions 6 January 30th 08 01:00 PM
how to copy a cell with formula from sheet 1 (data is all vertical) into sheet 2 parag Excel Worksheet Functions 3 June 15th 06 10:29 PM
Active Cell Copy And Paste Sheet to Sheet A.R.J Allan Jefferys New Users to Excel 4 May 4th 06 02:04 AM
copy cell from one sheet of worksheet to another sheet Planetjim Excel Discussion (Misc queries) 1 January 10th 06 09:36 AM
Copy text from same cell on every sheet to title sheet? Jon Excel Discussion (Misc queries) 2 February 9th 05 03:11 PM


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