ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code if/then (https://www.excelbanter.com/excel-programming/444410-re-vba-code-if-then.html)

Charles

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



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com