VBA code if/then

J

john taiariol

i would to create VBA code that will bring up a dialogue box if the
words "TOOL ASSEMBLY" are input under column "F". I would like to
place certain words A, B, C, D whatever in a corresponding column on
the same row. Is this possible? any help is greatly appreciated,
thanks.
 
G

Gord Dibben

Certainly possible using sheet event code.

Who/what decides which certain words(or whatever) are placed in the adjacent
column.

Some code to place values in column G at each row where "tool assembly" is input

Not case-sensitive.............

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col F
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 6 Then
n = Target.Row
If Excel.Range("F" & n).Value = "TOOL ASSEMBLY" Then
Excel.Range("G" & n).Value = "A, B, C, D or whatever"
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
J

john taiariol

Certainly possible using sheet event code.

Who/what decides which certain words(or whatever) are placed in the adjacent
column.

Some code to place values in column G at each row where "tool assembly" is input

Not case-sensitive.............

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col F
On Error GoTo enditall
    Application.EnableEvents = False
If Target.Cells.Column = 6 Then
        n = Target.Row
        If Excel.Range("F" & n).Value = "TOOL ASSEMBLY" Then
            Excel.Range("G" & n).Value = "A, B, C, D or whatever"
        End If
    End If
enditall:
    Application.EnableEvents = True
End Sub

Gord Dibben     MS Excel MVP



- Show quoted text -

this works great thanks. just one thing, is it possible to look for a
column heading such as "Name" instead of column "F", thanks again for
the help.
 

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

Top