View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default Unique ID on different sheets

Hi Joel

Thank you for the fast response -- I set up a new workbook with just 4
sheets and about 20 rows in Column A in each sheet with the ID numbers mixed
up on each sheet ran the macro and it put everything in colums B & C
correctly -- however I ran the macro again and it did not then put the info
in columns D & E it appears to have overwritten columns B & C -- In fact I
changed some of the values in sheet 1 and the same thing happened.

'Am I doing something wrong??


--
Many Thanks

Sue


"Joel" wrote:

Sub FillinData()

RowCount = 1
With Sheets("Sheet1")
Do While .Range("B" & RowCount) < ""
ID = .Range("B" & RowCount)
Val1 = .Range("C" & RowCount)
Val2 = .Range("D" & RowCount)
For Each sh In ThisWorkbook.Sheets
If sh.Name < "Sheet1" Then
Set c = sh.Columns("A:A").Find(what:=ID, _
LookIn:=xlValues)
If Not c Is Nothing Then
c.Offset(0, 1) = Val1
c.Offset(0, 2) = Val2
End If
End If
Next sh

RowCount = RowCount + 1
Loop
End With
End Sub

"Sue" wrote:

Hi All

Tis the season of goodwill perhaps all you experts out there will help with
my small problem.

Several days a week I receive emails in the following format

4161,WM2899 ,140,84

I have no problem copying and pasting in column A of Sheet1 then Text to
Columns
I may have as many as 400 rows as above all will be different the 1st 4
digits 4161 are of no use whatsoever so they have to be deleted -- WM2899 is
the ID number and could be anywhere in Column A on any of the 30 other sheets
in the workbook all with different names on finding the ID number on whatever
sheet or row I need the digits 140 to enter the 1st empty Column Cell on the
row the ID number is found -- Likewise the digits 84 in the next empty column
cell adjacent to the 140. If a macro can do this I would place a command
button on Sheet 1 and assign the macro.

Any help much appreciated



--
Many Thanks

Sue