If column B cell is a certain value then copy and paste the value to column A

Snaybot

New Member
Joined
Apr 28, 2015
Messages
40
So Far I have this its not working too well haha


Code:
Sub MI_TEST_1()
' MI_TEST_1 Macro
Dim nxtRow As Integer
Dim i As Integer
For i = 1 To Cells(Rows.Count, 2).End(xlUp).Row
    'If Left(Cells(i, 2), 1) = "T" Then
'Determine if change was to Column F (6)
 If Target.Column = 2 Then
'If Yes, Determine if cell = B
  If Target.Value = Left(Cells(i, 2), 1) = "T" Then
   nxtRow = Sheets(2).Range("B" & Rows.Count).End(xlUp).Row + 1
    Target.EntireRow.Copy _
     Destination:=Sheets(2).Range("A" & nxtRow)
  End If
 End If
End Sub


If the first letter of column B is a "T" then paste the value into the adjacent cell into column A


For Example:


IF cell B10 is "T1" then paste a "T" in to cell A10 if A10 is empty

Cross post:
http://www.msofficeforums.com/excel...lumn-b-cell-certain-value-then.html#post91452
http://www.excelforum.com/excel-pro...-paste-the-value-to-column-a.html#post4241066
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Code:
Sub copyPaste()
     c = "B"
     adjacentCell = "A"
     firstRow = 1
     lastRow = Range(c & Rows.Count).End(xlUp).Row
     r = firstRow
     Do Until r > lastRow
          myValue = Range(c & r).Value
          myLetter = LCase(Left(myValue, 1))
          adjacentCellValue = Range(adjacentCell & r).Value
          If myLetter = "t" And adjacentCellValue = "" Then
               Range(adjacentCell & r).Value = myValue
          End If
          r = r + 1
     Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,770
Messages
6,126,790
Members
449,336
Latest member
p17tootie

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