Nlhicks
Active Member
- Joined
- Jan 8, 2021
- Messages
- 264
- Office Version
- 365
- Platform
- Windows
Is there a better way to write this and have it still do what it is doing?
VBA Code:
Sub TryUpdate()
Dim RngRange01 As Range
rngRang01 = Range("A" & Rows.Count).End(xlUp).Row
Range("A2:P" & rngRang01).SpecialCells(xlCellTypeVisible).Select
If Worksheets("Line Update").Range("B11") <> Worksheets("Line Update").Range("E11") Then
Worksheets("Sheet2").Range("B2:B" & rngRang01).Value = Worksheets("Line Update").Range("E11").Value
End If
If Worksheets("Line Update").Range("B12") <> Worksheets("Line Update").Range("E12") Then
Worksheets("Sheet2").Range("C2:C" & rngRang01).Value = Worksheets("Line Update").Range("E12").Value
End If
If Worksheets("Line Update").Range("B13") <> Worksheets("Line Update").Range("E13") Then
Worksheets("Sheet2").Range("D2:D" & rngRang01).Value = Worksheets("Line Update").Range("E13").Value
End If
If Worksheets("Line Update").Range("B14") <> Worksheets("Line Update").Range("E14") Then
Worksheets("Sheet2").Range("E2:E" & rngRang01).Value = Worksheets("Line Update").Range("E14").Value
End If
If Worksheets("Line Update").Range("B15") <> Worksheets("Line Update").Range("E15") Then
Worksheets("Sheet2").Range("F2:F" & rngRang01).Value = Worksheets("Line Update").Range("E15").Value
End If
If Worksheets("Line Update").Range("B16") <> Worksheets("Line Update").Range("E16") Then
Worksheets("Sheet2").Range("G2:G" & rngRang01).Value = Worksheets("Line Update").Range("E16").Value
End If
If Worksheets("Line Update").Range("B17") <> Worksheets("Line Update").Range("E17") Then
Worksheets("Sheet2").Range("H2:H" & rngRang01).Value = Worksheets("Line Update").Range("E17").Value
End If
If Worksheets("Line Update").Range("B18") <> Worksheets("Line Update").Range("E18") Then
Worksheets("Sheet2").Range("I2:I" & rngRang01).Value = Worksheets("Line Update").Range("E18").Value
End If
End Sub