ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy data in turqouise colour cells from n to a (https://www.excelbanter.com/excel-programming/407539-copy-data-turqouise-colour-cells-n.html)

pswanie

copy data in turqouise colour cells from n to a
 
Private Sub CommandButton1_Click()
NewRowCount = 1
Lastrow = Range("N" & Rows.Count).End(xlUp).Row
For RowCount = 1 To Lastrow
If Range("N" & RowCount).Interior.ColorIndex = 8 Then
Range("d" & NewRowCount) = Range("N" & RowCount)
NewRowCount = NewRowCount + 1
End If
Next RowCount

End Sub



i got this string from joel... (thanx) but does not do what i need. in
fact clicking on the command button does nothing.


what i need is to copy all data in the cells with turqoise (8) colour from
column N to colum A.

[email protected]

copy data in turqouise colour cells from n to a
 
Hi
Code looks OK, except you need to change "d" to "A".
You might find this easier to run from a form button. Go to View,
Toolbars, Forms and click on the grey button icon. Drag out the button
shape with your mouse and assign the macro below:

Public Sub CopyIt()
NewRowCount = 1
Lastrow = Range("N" & Rows.Count).End(xlUp).Row
For RowCount = 1 To Lastrow
If Range("N" & RowCount).Interior.ColorIndex = 8 Then
Range("A" & NewRowCount) = Range("N" & RowCount)
NewRowCount = NewRowCount + 1
End If
Next RowCount

End Sub

The code is in a general code module. I suspect your commandbutton
code does not run because it is in the wrong place.

regards
Paul

On Mar 12, 7:54*am, pswanie wrote:
Private Sub CommandButton1_Click()
NewRowCount = 1
Lastrow = Range("N" & Rows.Count).End(xlUp).Row
For RowCount = 1 To Lastrow
* *If Range("N" & RowCount).Interior.ColorIndex = 8 Then
* * * Range("d" & NewRowCount) = Range("N" & RowCount)
* * * NewRowCount = NewRowCount + 1
* *End If
Next RowCount

End Sub

i got this string from joel... * (thanx) * but does not do what i need.. *in
fact clicking on the command button does nothing.

what i need is to copy all data in the cells with turqoise (8) colour from
column N to colum A.



pswanie

copy data in turqouise colour cells from n to a
 
i still cant get it to work....

i took liberty to mail a copy to u

the lines go on to 380. but i took some of it out




All times are GMT +1. The time now is 03:46 AM.

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