Solved: VBA Copy and Paste Specific Cells Based On Another Cells Value
Hi, I wonder whether someone may be able to help me please.
I've put together the following code which, carries out the following procedure:
- Starting at row 7 on the "Input" sheet, check to see if there is a value in column B.
- If present, then search for the value "P" in column I and "I" in column L.
- If these criteria are met, copy the value in column J and paste into column B on the "In Flights Project" page.
[vba]
Option Explicit
Sub InFlightProjects()
Dim LR As Long, i As Long
Sheets("In Flight Projects").Range("B7:B1307").Cells.ClearContents
With Sheets("Input")
LR = .Range("B" & Rows.Count).End(xlUp).Row
For i = 7 To LR
With .Range("J" & i)
If .Offset(, -1).Value = "P" And .Offset(, 2) = "I" Then Sheets("In Flight Projects").Cells(Application.Max(Sheets("In Flight Projects").Cells(Rows.Count, "B").End(xlUp).Row + 1, 7), "B").Value = .Value
End With
Next i
End With
Columns("A:M").EntireColumn.AutoFit
End Sub
[/vba]
The code works fine but I'm having a little difficulty in exanding the copy and paste ranges.
What I would like to do is instead of just copying the value in column J, I'd like to copy the values in columns J, K and O, and paste these into the columns B,C and D respectively, whilst maintainig the rest of the functionality.
I just wondered whether someone could possibly look at this please and offer soem guidance on how I may be able to achieve this.
Many thanks and kind regards
1 Attachment(s)
how to paste one single word in front of another cell based on cell value
hi i am recently join this forum.
i have little problem with copy one single word & paste it in another column based on value..
i have one sheet with heading column A = sr no. B=part No , C= Qty, D= Value , E="FMS"
and a3=F, a4=M,a5=S
and b3=20000, b4=40000, b5=90000
i would like to paste WORDS FMS in column E based on VALUE OF COLUMN D
MEANS if value of a cell in column D is < 20000 then in column E auto paste the word F
please see attached file
thanks in advance
i am very new for using vba please help me