Saturday 19 January 2019

excel - Range1.Value = Range2.Value not populating

I am attempting to move ranges of cells to one row, but different columns. The code worked fine when I was copy/pasting, but the sheet slowed down dramatically. This method seems to work faster, though the actual cells are not populating. Code below:


lastRow = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
For i = 2 To lastRow
If Cells(i, 4).Value = Cells(i + 1, 4).Value Then '1st if
Debug.Print Cells(i, 4).Value & " " & Cells(i + 1, 4).Value
If Cells(i, 4).Value = Cells(i + 2, 4).Value Then '2nd if
Debug.Print Cells(i, 4).Value & " " & Cells(i + 2, 4).Value
If Cells(i, 4).Value = Cells(i + 3, 4).Value Then '3rd if
Debug.Print Cells(i, 4).Value & " " & Cells(i + 3, 4).Value
If Cells(i, 4).Value = Cells(i + 4, 4).Value Then '4th if
Debug.Print Cells(i, 4).Value & " " & Cells(i + 4, 4).Value
If Cells(i, 4).Value = Cells(i + 5, 4).Value Then '5th if
Debug.Print Cells(i, 4).Value & " " & Cells(i + 5, 4).Value
Else '~~~~~>RANGE1.VALUE = RANGE2.VALUE BELOW
Cells(i + 4, 52).Value = 5
Range(Cells(i, 40), Cells(i, 50)).Value = Range(Cells(i + 4, 53), Cells(i + 4, 63)).Value
Range(Cells(i + 1, 40), Cells(i + 1, 50)).Value = Range(Cells(i + 4, 64), Cells(i + 4, 74)).Value
Range(Cells(i + 2, 40), Cells(i + 2, 50)).Value = Range(Cells(i + 4, 75), Cells(i + 4, 85)).Value
Range(Cells(i + 3, 40), Cells(i + 3, 50)).Value = Range(Cells(i + 4, 86), Cells(i + 4, 96)).Value
i = i + 4
End If

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...