ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying Cell Value (https://www.excelbanter.com/excel-programming/345564-copying-cell-value.html)

STEVEB

Copying Cell Value
 

Hi,

Does anyone have any suggestions for the following:

On Workbook 1, Sheet One has approximately 50 rows of data. The data
is in Column C and has about 10 different #'s (The other 40 cells in
Column C contain duplicates).

I would like a code that would look at column C in workbook one and
copy each number that is not a duplicate to a different sheet in
Workbook two (Cell B2).

For example Column C Workbook One contains the following non-duplicate
#'s
10, 20, 30 (All other #'s in Column C are duplicates). I would like
the Code to post the #'s in Workbook two as follows:

Workbook Two(Cell B2):

Sheet1 - 10
Sheet2 - 20
Sheet3 - 30

Any help would be greatly appreciated.

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile: http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=484890


Tom Ogilvy

Copying Cell Value
 
Dim nodupes as New Collection
Dim itm as Variant
Dim rng as Range
Dim i as Long
Dim cell as Range
with Workbooks("Workbook1.xls").Worksheets("Sheet One")
set rng = .range(.cells(2,1),.cells(2,1).end(xldown))
End with

On error resume next
for each cell in rng
nodupes.add cell.Value, cell.Text
next
On Error goto 0

set bk = Workbooks("Workbook2.xls")
i = 1
for each itm in nodupes
bk.worksheets(i).Range("A1").Value = itm
i = i + 1
Next

--
Regards,
Tom Oilvy


"STEVEB" wrote in
message ...

Hi,

Does anyone have any suggestions for the following:

On Workbook 1, Sheet One has approximately 50 rows of data. The data
is in Column C and has about 10 different #'s (The other 40 cells in
Column C contain duplicates).

I would like a code that would look at column C in workbook one and
copy each number that is not a duplicate to a different sheet in
Workbook two (Cell B2).

For example Column C Workbook One contains the following non-duplicate
#'s
10, 20, 30 (All other #'s in Column C are duplicates). I would like
the Code to post the #'s in Workbook two as follows:

Workbook Two(Cell B2):

Sheet1 - 10
Sheet2 - 20
Sheet3 - 30

Any help would be greatly appreciated.

Thanks


--
STEVEB
------------------------------------------------------------------------
STEVEB's Profile:

http://www.excelforum.com/member.php...fo&userid=1872
View this thread: http://www.excelforum.com/showthread...hreadid=484890





All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com