If Cell = "X" then copy from column Y and Paste into last row on another tab

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,342
Office Version
  1. 365
Platform
  1. Windows
I have a table "Task_List" where the user will enter an X in column B if they want to use the data from that applicable row

How do I look down column B and where there is an X, copy the value in column Y and Paste it to tab "PBoMTaskList" (or sheet15) starting in B11 - looping through column B to find each time there is an X

Thank you for the help.

Code:
Sub PBOMTASKLISTID()

Dim lrow As Long

lrow = Sheet14.Range("Task_List").Columns(3).Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row



End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Partly there, but I cannot get it to paste

Code:
Sub PBOMTASKLISTID()

Dim lrow1 As Long
Dim lrow2 As Long
Dim iCount As Integer

lrow1 = Sheet14.Cells(Rows.Count, "C").End(xlUp).Row
lrow2 = Sheet15.Cells(Rows.Count, "B").End(xlUp).Row


    For iCount = 15 To lrow1

        If Cells(iCount, 2) = "X" Then Cells(iCount, 25).Copy
        

        Sheet15.Range("B" & lrow2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
          Application.CutCopyMode = False
        
    Next iCount

End Sub
 
Upvote 0
Getting closer but still do not have it

Code:
Sub PBOMTASKLISTID()

Dim lrow1 As Long
Dim lrow2 As Long
Dim iCount As Integer

lrow1 = Sheet14.Cells(Rows.Count, "C").End(xlUp).Row
lrow2 = Sheet15.Cells(Rows.Count, "B").End(xlUp).Row


    For iCount = 15 To lrow1

        If Cells(iCount, 2) = "X" Then Sheet15.Range("B" & lrow2).Value = Cells(iCount, 25).Value
        
    Next iCount

End Sub
 
Upvote 0
What about this:

Code:
Sub PBOMTASKLISTID()

Dim lrow As Long, i As Long, iRow

lrow = Worksheets("Task_List").Cells(Rows.Count, "B").End(xlUp).Row
iRow = 11
For i = 1 To lrow
  If Cells(i, "B") = "X" Then
    Worksheets("PBoMTaskList").Cells(iRow, "B") = Worksheets("Task_List").Cells(i, "Y")
    iRow = iRow + 1
  Else
  End If
Next i

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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