Copy to a cell, based on the value of another C

rdev

Active Member
Joined
Dec 3, 2007
Messages
273
****

This text is found in Column C3 "*2050_Land and Building"
If "_" is present it cannot be copied to cell B3, else C3 is copied in Column B3, The macro should find out the last row in column C and repeat the process through out the whole of column C.
I cannot figure a vba code for this and am asking for a help
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Is this what you need?
Code:
Sub Test()
    For Each cll In Range("C1:C" & Range("C" & Rows.Count).End(xlUp).Row)
        If Not cll Like "*_*" Then cll.Offset(, -1) = cll
    Next cll
End Sub
 
Upvote 0
Try this:

Code:
Sub Copy_Over()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
    For i = 1 To Lastrow
        If InStr(Cells(i, 3).Value, "_") Then
            Else
                Cells(i, "B").Value = Cells(i, "C").Value
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Try this:

Code:
Sub Copy_Over()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "C").End(xlUp).Row
    For i = 1 To Lastrow
        If InStr(Cells(i, 3).Value, "_") Then
            Else
                Cells(i, "B").Value = Cells(i, "C").Value
        End If
    Next
Application.ScreenUpdating = True
End Sub

Thanks you very much, it works and was a great help
 
Upvote 0

Forum statistics

Threads
1,214,379
Messages
6,119,190
Members
448,874
Latest member
Lancelots

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top