This doesn't seem to work. Maybe I should give more background:
-I have 2 sheets: 'Mgmt Rev' and 'MP'
-If any rows in column F of 'Mgmt Rev' have: "FFP", "Conceptual",
"SOTA", "Very High", "0-50%", "Extreme", "New", "Poor", "Prewired",
"None", "Very High", "1", or "0-25%" then I want column D of that row
to be copied to coulmn B of sheet 'MP'
Is this possible?
Thanks for your help!
Orig email:
First - please leave any previous messages in your replys. Makes it
easier
to follow what has gone on before (my viewer is set to not display read
messages).
So let's walk through some code... note that any line with a '
represents a
note to the code.
Write back and let me know how it works. Also if you need more help...
"MySheet" is the name I will use to represent your data sheet (replace
with
the actual name)
In your Conditional Format you indicate that you have 2 conditions.
For simplicity I'll call condtion1 as something like formula is =3D
D1=3D
25
and condition 2 as something like formula is =3D E1 =3D 56
Using R1C1 notation
column D becomes =3D RC4=3D 25
column E becomes =3D RC5=3D 56
Note that Range("$D$5") =3D Cells(5,4)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=AD=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=AD=3D=3D
Sub TransfertoMP()
Dim rw as long, lrw as long, prw as long ' define variables for
row
numbers
' this finds the last used row in column A
lrw =3D Sheets("MySheet").Cells(Rows.C=ADOUNT, "A").End(xlUp).Row
' loop from 1st row to last row
For rw =3D 1 to lrw
' If cell in Column D =3D condition1
if cells(rw,4) =3D 25 then
' copy cell in MP column B to MP
Sheets("MP").Cells(prw,2) =3D Sheets("MySheet").Cells(rw,2)
' if cell in column E =3D condition2
elseif cells(rw,5)=3D56 then
' find first empty row on "MP"
prw =3D Sheets("MP").Cells(Rows.COUNT, "A").End(xlUp).Row + 1
' copy cell in MP column B to MP
Sheets("MP").Cells(prw,2) =3D Sheets("MySheet").Cells(rw,2)
' this one is only if you want a third option of something to
do
else
' any other code you want
end if
next
End Sub
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=AD=3D=3D=3D=3D=3D=3D=3D=3D
--=20
steveB=20
Remove "AYN" from email to respond
Bookmarks