Hi - I am trying to write a code that searches for any value in a cell in column B. If it has a value to copy it to the cell next to it in column C. If it is blank I want it to leave it alone. Then move on to the next cell down in B and repeat..all the way down to my last cell in B.
Here is what I have:
Sub copypaste()
Dim i As Integer
Dim LastRow As Integer 'Long?
ActiveSheet.Range.Cells("B1").Select
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 1 To LastRow
If ActiveSheet.Range.Cells(i, "B") = "" Then
Selection.Offset(1, 0).Select
ElseIf ActiveSheet.Range.Cells(i, "B") <> Nothing Then
Range.Cells(i, "B").Copy
Range.Cells(i, "C").Paste
End If
Next i
End With
End Sub
Thanks for your help - Jim A
Here is what I have:
Sub copypaste()
Dim i As Integer
Dim LastRow As Integer 'Long?
ActiveSheet.Range.Cells("B1").Select
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For i = 1 To LastRow
If ActiveSheet.Range.Cells(i, "B") = "" Then
Selection.Offset(1, 0).Select
ElseIf ActiveSheet.Range.Cells(i, "B") <> Nothing Then
Range.Cells(i, "B").Copy
Range.Cells(i, "C").Paste
End If
Next i
End With
End Sub
Thanks for your help - Jim A