Macro Help

D

DNA

I'm sure this will be a Macro:

I have several sheets with a workbook that contain part numbers. If a
part number = X, then place an employee number in the next column directly
beside the part number column.

NOTE: Part numbers vary from column to column throughout the work book.

Thanks for your help!!
 
D

Don Guillett

Have a look in VBA help index for FINDNEXT. There is a good example you can
modify.
 
D

DNA

It doesn't appear that FINDNEXT would be the choice I should use.

I want one macro that searches all worksheets, and if it finds a part
number of 54789, then put employee number 005 in the column directly
beside the part number. This way when one value is entered, it populates
the entire workbook.

Hope this makes sense.
 
D

Don Guillett

Still not clear what you want. If desired you may send to the address BELOW
a SMALL workbook example and I will take a look. With that make a CLEAR
explanation of what you want as I will not go back to this thread to look at
the problem.
 
D

Don Guillett

Why not? Modified from Help. I added the for each sh loop

Sub findnumbersinallworksheets()
For Each sh In Worksheets
With sh.Cells
Set c = .Find(54789, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do

c.Offset(, 1) = "005"
c.Offset(, 1).NumberFormat = "000"

Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Next sh
End Sub
 
Top