ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy contents if....... (https://www.excelbanter.com/excel-programming/353545-copy-contents-if.html)

Metrazal

Copy contents if.......
 

I am looking for a way to do the following:

If ("d1:d999") = "text in the cell" then copy ("e1:e999") to
("f1:f999")

In other words I have a standard text like "tax" in d3, d18, d44, etc.
If this text exsists then I want to copy e3, e18, e44, etc. to f3, f18,
f44.

If this possible?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=513359


Toppers

Copy contents if.......
 
Hi,

Sub CopyEtoF()
mytext = "Whatever you want"
For i = 1 To 999
If Cells(i, "D") = mytext Then Cells(i, "F") = Cells(i, "E")
Next i
End Sub

"Metrazal" wrote:


I am looking for a way to do the following:

If ("d1:d999") = "text in the cell" then copy ("e1:e999") to
("f1:f999")

In other words I have a standard text like "tax" in d3, d18, d44, etc.
If this text exsists then I want to copy e3, e18, e44, etc. to f3, f18,
f44.

If this possible?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=513359



Tom Ogilvy

Copy contents if.......
 
Sub copydata()
Dim cell as Range
for each cell in Range("d1:d999")
if instr(1,cell.Value,"tax",vbTextCompare) then
cell.offset(0,1).copy cell.offset(0,2)
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"Metrazal" wrote in
message ...

I am looking for a way to do the following:

If ("d1:d999") = "text in the cell" then copy ("e1:e999") to
("f1:f999")

In other words I have a standard text like "tax" in d3, d18, d44, etc.
If this text exsists then I want to copy e3, e18, e44, etc. to f3, f18,
f44.

If this possible?

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile:

http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=513359





All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com