View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Charles Charles is offline
external usenet poster
 
Posts: 36
Default VBA code if/then

Hi,

Perhaps something like this may help.

Code:
Sub test()
Application.ScreenUpdating = False
Dim myrng As Range

For Each myrng In Sheets("Sheet1").Range("F2:F" & Sheets("Sheet1").Range("F65536").End(xlUp).Row)
    If Sheets("Sheet1").Cells(myrng.Row, 6).Text = "TOOL ASSEMBLY" Then
        MsgBox "Tool Assembly"
        Sheets("Sheet1").Cells(myrng.Row, 1).Value = "Test"
        Sheets("Sheet1").Cells(myrng.Row, 2).Value = "Test1"
        Sheets("Sheet1").Cells(myrng.Row, 3).Value = "Test2"
        Sheets("Sheet1").Cells(myrng.Row, 4).Value = "Test3"
    End If
Next
End Sub