tzexu1610

01-15-2018, 06:40 PM

Hi guys

So... I've got 3 columns in my excel spreadsheet, I,J and L. Looks something like this:

I J L

1 1 1

3 3 3

4 7 4

5

6

7

The column L is supposedly empty but I wanna make those numbers appear there.L would be based on I and J. The below is my code. Some help would be much appreciated .

Sub trial2()

Dim cell As Range

Dim i As Integer

Dim j As Integer

Dim c As Range

i = 0

j = 0

For Each c In Columns("L")

i = i + 1

j = j + 1

c = i

If Cells(i, "I").Value = Cells(i, "J").Value Then

Cells(j, "L").Value = Cells(i, "J").Value

ElseIf Cells(i, "I").Value < Cells(i, "J").Value Then

Cells(j, "L").Value = Cells(i, "I").Value + 1

End If

Next c

End Sub

So... I've got 3 columns in my excel spreadsheet, I,J and L. Looks something like this:

I J L

1 1 1

3 3 3

4 7 4

5

6

7

The column L is supposedly empty but I wanna make those numbers appear there.L would be based on I and J. The below is my code. Some help would be much appreciated .

Sub trial2()

Dim cell As Range

Dim i As Integer

Dim j As Integer

Dim c As Range

i = 0

j = 0

For Each c In Columns("L")

i = i + 1

j = j + 1

c = i

If Cells(i, "I").Value = Cells(i, "J").Value Then

Cells(j, "L").Value = Cells(i, "J").Value

ElseIf Cells(i, "I").Value < Cells(i, "J").Value Then

Cells(j, "L").Value = Cells(i, "I").Value + 1

End If

Next c

End Sub