ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copying some cells (https://www.excelbanter.com/excel-programming/334036-copying-some-cells.html)

cacique[_6_]

copying some cells
 

Hi, I have a spreadsheet whit a list of some colors in the same column
the list length depends from another macro (b2 to ..), I need a cod
that every time in the list is the color blue, its copied 2 column
ahead in the same row.

Example. if in the list I have color blue in the cells b4, b7, b10
b20 I need to copy that word blue in the cells d2, d7,d10,d2

--
caciqu
-----------------------------------------------------------------------
cacique's Profile: http://www.excelforum.com/member.php...fo&userid=2486
View this thread: http://www.excelforum.com/showthread.php?threadid=38574


Trevor Shuttleworth

copying some cells
 
One way:

Sub CopyBlue()
Dim c As Range
Application.ScreenUpdating = False
For Each c In Range("B2:B" & Range("B" & Rows.Count).End(xlUp).Row)
If c.Value = "blue" Then c.Offset(0, 2).Value = c.Value
Next 'c
Application.ScreenUpdating = True
End Sub

Regards

Trevor


"cacique" wrote in
message ...

Hi, I have a spreadsheet whit a list of some colors in the same column,
the list length depends from another macro (b2 to ..), I need a code
that every time in the list is the color blue, its copied 2 columns
ahead in the same row.

Example. if in the list I have color blue in the cells b4, b7, b10 ,
b20 I need to copy that word blue in the cells d2, d7,d10,d20


--
cacique
------------------------------------------------------------------------
cacique's Profile:
http://www.excelforum.com/member.php...o&userid=24861
View this thread: http://www.excelforum.com/showthread...hreadid=385746





All times are GMT +1. The time now is 12:23 AM.

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