Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
can someone please alter this code so that if a cell in column D is NOT red, then data pastes to column F instead of column G. Currently, rows with a red cell in column D paste to column A and G on sheet VKnew. I want the rows without a red cell in column D to paste to column F (not G) on VKnew. Private Sub CommandButton3_Click() CopyData Range("D9:D13"), "FEEDER" CopyData Range("D16:D58"), "MACHINE" CopyData Range("D63:D73"), "DELIVERY" CopyData Range("D78:D82"), "PECOM" CopyData Range("D88:D94"), "ROLLERS" CopyData Range("D104:D128"), "MISCELLANEOUS" Dim rng As Range, cell As Range Dim nrow As Long, rw As Long Dim Sh As Worksheet Set rng = Range("D9:D94") nrow = Application.CountIf(rng, "0") Set Sh = Worksheets("VK new") Debug.Print Sh.Range("A10").Resize(nrow * 1, 1).EntireRow.Address(external:=True) ' sh.Range("A10").Resize(nrow * 1).EntireRow.Insert rw = 10 For Each cell In Range("D9:D98") If Not IsEmpty(cell) Then If IsNumeric(cell) Then If cell.Interior.ColorIndex = 3 And cell.Value 0 Then 'If cell 0 Then Cells(cell.Row, 1).Copy Sh.Cells(rw, "A").PasteSpecial Paste:=xlPasteValues Cells(cell.Row, 4).Copy Sh.Cells(rw, "G").PasteSpecial Paste:=xlPasteValues rw = rw + 1 End If End If End If Next End Sub Thank you!!!!!! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I customise colours used in charts and keep those colours. | Charts and Charting in Excel | |||
How to save one of the MORE COLOURS in the THEME COLOURS? | Excel Discussion (Misc queries) | |||
how do I change color of "active" cell to differentiate from rest | Excel Discussion (Misc queries) | |||
using value of cell to differentiate 3 group of testing sequences | Excel Worksheet Functions | |||
Excel 2003 font colours and cell colours | Excel Discussion (Misc queries) |