ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro code (https://www.excelbanter.com/excel-programming/419459-macro-code.html)

richzip

Macro code
 
How can I set up a macro code to do the following:

If a specific value is found in Column A (say: SBY), then column C should
be set to equal whatever value is found in Column B (this value could be
several different things).

Thank you!

Simon Lloyd[_925_]

Macro code
 

Not tested just written here but should do what you want it to do!

Sub Copy_B_To_C()
Dim Rng As Range, MyCell as range
Set rng= Range("A1:A" & range("A" & rows.count).end(xlup).row)
for each mycell in rng
if mycell.value ="SBY" then
mycell.offset(0,3)=mycell.offset(0,2)
end if
next mycell
end sub


--
Simon Lloyd

Regards,
Simon Lloyd
'www.thecodecage.com' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=24509



All times are GMT +1. The time now is 04:19 PM.

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