Copying Cell Value

  • Thread starter Thread starter STEVEB
  • Start date Start date
S

STEVEB

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top