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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,801
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

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
19,343
Office Version
  1. 2021
Platform
  1. Windows
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

rdev

Active Member
Joined
Dec 3, 2007
Messages
273
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,191,416
Messages
5,986,430
Members
440,029
Latest member
GabSSSH

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
Top